Learn how to a build a cloud-first strategyRegister Now


Firefox obstructs loading php file into iframe

Posted on 2006-03-30
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


Question by:rscandc0
  • 3
  • 2

Expert Comment

ID: 16333298
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?

Author Comment

ID: 16333972
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


Accepted Solution

nitinsy earned 2000 total points
ID: 16340052
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

Author Comment

ID: 16347830
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

Expert Comment

ID: 16348274
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).

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Suggested Courses
Course of the Month20 days, 23 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question