We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


Firefox obstructs loading php file into iframe

rscandc0 asked
Medium Priority
Last Modified: 2013-11-19
I have stuffed around with this problem for too long so

I have two files,a page containing an iframe (doesnt seem to matter whether its hidden or not) and the file for the iframe
I am loading the iframe with a php file (eventually will be from another sites server but i need it to work on mine first). So far It works locally on my desktop..both files are local, same directory..no probs with Firefox or IE.

So I uploaded the files to my website and

IE works fine ...iframe loaded and alls well.
Firefox comes up with a window saying words to the effect of

You have chosen to open


which is a php file

what should firefox do with this file?

.   open with   then a choice of php auto file or other

. save to disk

selecting php auto it opens notepad, select other it opens a directory looking for applications. The answer to its question is..put it in the frickin iframe.

Now..if I try this with a different source of the same php file (ie from a different site). I say its the same as the HTML is the same ..whether there are hidden characters I dont know. The iframe loads but I get access denied later in my script (to be expected due to diff domains)

So if anyone can help it would be appreciated


Watch Question

You are using a PHP. I am assuming you want this to execute on the server and just return plain HTML to the client. With the information you have given, it appears your web server is not configured to process PHP files. It is probably sending the wrong content-type header to the client. Try typing the iframe URL into the address bar and see what happens.

Which web server are u using?


Thanks for your response.  OK. I am activating the php by making it the source for the iframe, and yes I am expecting HTML to be returned. I already tried the iframe url in the address of Firefox and IE...IE is fine and Firefox intervenes. However firefox does load the correct (with the exception of any non visible data) into notepad when I select that option.

So how come it works with IE with the same php file if the server is not configured to process php files?? (I know that FF and IE do things differently but this seems a bit fundamental.

The site is users.bigpond.net.au which uses MS IIS 5.0 Webserver

From what you are describing it seems to be a problem with the content-type header being sent to the client. Try create a MIME map entry in IIS for php extension.

Content-type should be text/html for the browser to render it as html

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


I have accepted your answer. It was a content type issue. It was the PHP script not working and no html output so i just got the php file not the raw HTML (who knows why...don't ask) . The PHP file contained HTML with the correct Content-type but I guess Firefox didnt understand and put it in the "too hard" basket.  I cant mess around with the PHP script so am putting the expected PHP output as an HTML file on the server and downloading that. You may say why!!! Well I am trying to test as much in the real environment as I can. And of course the gotcha now is that Firefox tells me permission denied when I try and access the innerHTML in the Iframe even tho the file in there is from the same domain as the main page. Probably missing data due to the way I put it there..eg no headers generated by a real php script.

Any ideas how the browser determines permission denied  ie where does it get the domain name for the iframe page..it is certainly not in the HTML (or is this a separate question??) HTTP headers maybe??

Anyway thanks for your help.... I still need to try and test this stuff until I can get in touch with the person whose PHP script it is so the problem has moved on.

BTW interesting how benign and tolerant  IE is with this scenario

Both browsers use the domain name in the url to avoid cross-domain scripting. There are no headers that define the domain. Just make sure both domans are the same.

Another thing that could cause this problem is the timing of accessing the iframe content. You should do it after the iframe has loaded completely. This can get tricky because you want to access the iframe from the main browser windows while the load event is triggered inside the iframe (on the body tag of the html in the iframe).
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.