7

I have following code. I wanted to load the page inside an iframe. But it is showing only loader into an iframe. i have this problem only in IE 11. In all the browser it is working fine.

<iframe src="https://docs.google.com/viewer?url=http://localhost/test_energy/img/Sample.pdf&embedded=true" width="570" height="300" style="border: none;">
</iframe>
Ayesha
  • 592
  • 2
  • 4
  • 15

3 Answers3

9

try:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/> 
hizbul25
  • 3,519
  • 4
  • 21
  • 35
  • The question is about using it in an iFrame. What does your "solution" do? Perhaps some explanation would be great. – Xonshiz Jun 10 '20 at 08:38
  • This solution tells the browser to interpret using the IE11 Emulate document compatbility mode, which helps the software determine which features to use, such as iFrame use - as per this next answer those options are detailed: https://stackoverflow.com/questions/6771258/what-does-meta-http-equiv-x-ua-compatible-content-ie-edge-do – Davemundo Jun 29 '20 at 11:16
0

Add a function called attachEvent inside the iframe ..like this (before jQuery script tag in IFRAME):

var isIE11 = !!(navigator.userAgent.match(/Trident/) && !navigator.userAgent.match(/MSIE/));

if (isIE11) {
  if (typeof window.attachEvent == "undefined" || !window.attachEvent) 
  window.attachEvent = window.addEventListener; 
}
OMengi
  • 1
-1

First try removing the semicolon ";" from your initial code

<iframe src="https://docs.google.com/viewer?url=http://localhost/test_energy/img/Sample.pdf&embedded=true" width="570" height="300" style="border: none;">;<- Remove this

;<- Remove this

and then try e.g. should work fine

<iframe src="https://docs.google.com/viewer?url=http://tobi.oetiker.ch/lshort/lshort.pdf&embedded=true" width="570" height="300" style="border: none;"></iframe>
Tushar Gupta - curioustushar
  • 54,013
  • 22
  • 95
  • 103
mattts
  • 312
  • 2
  • 6
  • 17
  • @matts Hey there is not any semicolon after iframe,actually angle braket was not taking thats y I given <.Now I removed it. – Ayesha Feb 11 '14 at 07:18
  • ok noted on my browser it shows a semicolan (weired) any ways. Try this solution as well http://stackoverflow.com/questions/14559060/display-pdf-using-an-ajax-call – mattts Feb 11 '14 at 09:02
  • And almost forgot try if it works on Firefox it will most probably work on IE11, I think the culprit is with your PDF plugin for IE – mattts Feb 11 '14 at 09:05