Internet Explorer 7/8/9 : IFRAME invisible

2019-09-12 06:16发布

问题:

I am trying to create an iframe for the following url. http://www.pgsoftwaresolutions.in/index.html

<iframe src="http://www.pgsoftwaresolutions.in/index.html" width="255" height="210"></iframe> 

I tried it on IE7 locally and IE 8/9 on browserstack.com The page loads the timer works correctly when loaded directly in the IE browser, but when in an IFRAME it becomes invisible.

At first i thought that it might a jQuery issue or IE bug about IFRAME not triggering the document ready/load event.

Just to test what went wrong where in the javascript i added a javascript alert() in the javascript function which replaces the numbers on the timer on a copy of the above code in http://www.pgsoftwaresolutions.in/debug/index.html

NOTE: To close this page after the first 7 alerts are fired. Quickly press ENTER and then CTRL + F4 to close the page.

I tested it on IE 7. It works and a series of alerts are fired at the start and then one every second.

Then i loaded the same page in an IFRAME and it DOES throw the alerts.

<iframe src="http://www.pgsoftwaresolutions.in/debug/index.html" width="255" height="210"></iframe>

I have no clue how to debug anything related to javscript or IFRAMEs on IE7 properly as Firebug lite does not support those so any help will be appreciated.

回答1:

The problem is in your styles.css.

Remove html{ position:relative; } and your iframe will display in IE7 and higher.