Ayesha
Ayesha

Reputation: 622

page is not loading inside the iframe in IE11

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>

Upvotes: 8

Views: 21967

Answers (3)

OMengi
OMengi

Reputation: 1

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; 
}

Upvotes: 0

mattts
mattts

Reputation: 352

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>

Upvotes: -1

hizbul25
hizbul25

Reputation: 3849

try:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE11"/> 

Upvotes: 9

Related Questions