Jump to content

Recommended Posts

Hey guys,

 

does anybody use "windows" and "firefox" for web development?

 

So, here is the issue.

 

I decided to install a "windows" system (VISTA) inside my virtual machine.Then, I created an index.php file on the desktop (without a web server and php at all). Inside this index file I've created a html h2 tag with the text <h2>Hello World</h2>. When I open the file through firefox  I see the output like html? Why? Is it normal for windows and filrefox? I'm confused.

The cache in the browser is disabled.

Edited by jazzman1
Link to comment
https://forums.phpfreaks.com/topic/282025-windows-firefox-and-php-files/
Share on other sites

If you mean it displays the HTML source rather than rendering it, I'd gather it probably just treats the file as plain text. If you mean it renders the HTML, that is fairly typical I believe. It will sniff the file contents to try and determine what it is rather than just base it on the extension. If it looks like HTML it'll get rendered as HTML. With a little experimenting it seems to base it's decision on whether the first word looks like something HTML. If so, it renders as HTML. If not, it renders as plain text.

A lot of browsers (and even other software) these days does intelligent guessing as to what a file's content truly is rather than just blindly assume that it is whatever the extensions says it is. They often examine the start and/or end bytes of a file for some kind of magic sequence to indicate what content type is being dealt with. Take a random .png/.jpg/.bmp/.gif file and rename the extension to some incorrect type and open it in one of the browsers. Chances are it will still get properly interpreted because these files have header sequences that identify what content it is.

 

Exactly when and how the browser does such guessing may vary from browser-to-browser. Some may only do it if the file type is unknown. Others may do it always. Older versions of IE used to ignore the Content-type http header and guess the content type, meaning when someone served something HTML like as Content-type: text/plain intentionally, say as an example, IE would still render the HTML. It caused much annoyance among people and was eventually fixed in the later versions.

 

A lot of browsers (and even other software) these days does intelligent guessing as to what a file's content truly is rather than just blindly assume that it is whatever the extensions says it is.

No, it wasn't the latest version of firefox, 4.something...when I updated with the latest one the result was the same.

For example, on my CentOS machine I'm using the latest version of firefox without any problems. 

Edited by jazzman1
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.