11

I have to create an Image slider for which I am using:

"Galleriffic plugin > http://www.twospy.com/galleriffic/",

in the Image slider, along with images, I have to show PDFs for some cases.

And to show that, I am putting the <div> which embeds PDF inside "<div class="caption">" where you can show the description related to the image.

For the Slider with PDF, you can see the full code here: http://jsfiddle.net/Z99gr/2/

I am trying to embed the PDF using <object> or <embed> tag, It works fine in Chrome and Firefox. BUT not in IE11.

I am not able to understand what is missing as I have create one more fiddle with just one div which embeds the PDF and its works fine in all three browser, Chrome, Firefox and IE11.

http://jsfiddle.net/dmAM3/1/

Please look into the issue and suggest ASAP what am I missing for IE 11.

Thanks!


Restricted access to subpages using age verification

Hi this is my first time trying to do this and I dont know where to start. I'm trying to make simple Yes or No age verification to my .aspx page which includes sub-pages. I want it to be so, that you need to press Yes before you can continue to subpages and if you try to type it like http://www.page.com/ageverification/subpage.aspx you are automatically redirected to ageverification page. Any examples are welcome cause I'm new in to this. Thank you for your time!

4

3 回答 3

25

I was now able to embed the PDF file IE using "<iframe>" tag.

I replaced "<object>" and "<embed>" tag with <iframe> and its working fine now with all 3 browsers, Firefox, Chrome and IE.

There are 2 ways of embedding PDF in IE.

1st way: Call PDF directly in <iframe>

Below is the updated code:

<div id="pdf">
   <iframe src="https://www.adobe.com/products/pdfjobready/pdfs/pdftraag.pdf" style="width: 100%; height: 100%;" frameborder="0" scrolling="no">
        <p>It appears your web browser doesn't support iframes.</p>
   </iframe>
</div>

2nd way: if the browser doesn't have PDF reader the u can call an HTML page in <iframe> which contains <object> tag .

Below is the code for 2nd option

    <div id="pdf">
          <iframe src="pdf.html" style="width: 100%; height: 100%;" frameborder="0" scrolling="no">
               <p>It appears your web browser doesn't support iframes.</p>
          </iframe>
   </div>

Code for "pdf.html"

<body>
    <object data="lorem.pdf" type="application/pdf">
        <p>It appears you don't have Adobe Reader or PDF support in this web browser. <a href="lorem.pdf">Click here to download the PDF</a>. Or <a href="http://get.adobe.com/reader/" target="_blank">click here to install Adobe Reader</a>.</p>
       <embed src="lorem.pdf" type="application/pdf" />
    </object>
</body>

This worked for me!!!

Here is the WORKING Fiddle : http://jsfiddle.net/stmjvz4f/

Hope it will be helpful for others in future!

于 2014-01-28T21:34:44.957 回答
2

我建议检查 PDFObject,它是一个用于将 PDF 嵌入 HTML 文件的 Javascript 库。它很好地处理了浏览器的兼容性,并且很可能会一直工作到 IE8。

在您的 HTML 中,您可以设置一个 div 来显示 PDF:

<div id="pdfRenderer"></div>

然后,您可以使用 Javascript 代码在该 div 中嵌入 PDF:

var pdf = new PDFObject({
  url: "https://something.com/HTC_One_XL_User_Guide.pdf",
  id: "pdfRendered",
  pdfOpenParams: {
    view: "FitH"
  }
}).embed("pdfRenderer");
于 2014-01-23T22:00:01.760 回答
1

不要在 <object> 中放置 'type' 属性,像这样在 <embed> 中放置:<object> 中的 type 属性导致 IE11 中的 Adob​​e Reader 出现权限错误。

<object data="mydocument.pdf">
<p><a href="mydocument.pdf">Download</a></p>
<embed type="application/pdf" src="mydocument.pdf" />
</object>

您不必将其放在 iframe 中。它可以显示控件,所以我认为它不会像预期的那样在滑块内工作。

于 2018-10-03T13:47:10.860 回答