Firefox obstructs loading php file into iframe

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

    Expert Comment

    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

    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 which uses MS IIS 5.0 Webserver

    LVL 1

    Accepted Solution

    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

    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 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 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
    LVL 1

    Expert Comment

    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

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
    Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
    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 learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    730 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now