jazzman1 Posted September 9, 2013 Share Posted September 9, 2013 (edited) 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 September 9, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/282025-windows-firefox-and-php-files/ Share on other sites More sharing options...
kicken Posted September 10, 2013 Share Posted September 10, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/282025-windows-firefox-and-php-files/#findComment-1448921 Share on other sites More sharing options...
jazzman1 Posted September 10, 2013 Author Share Posted September 10, 2013 I mean, it's rendering the output as html content rather than displaying the html source code as a plain text. That's why I'm getting confused. Quote Link to comment https://forums.phpfreaks.com/topic/282025-windows-firefox-and-php-files/#findComment-1448922 Share on other sites More sharing options...
kicken Posted September 10, 2013 Share Posted September 10, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/282025-windows-firefox-and-php-files/#findComment-1448924 Share on other sites More sharing options...
jazzman1 Posted September 10, 2013 Author Share Posted September 10, 2013 Here it is: Quote Link to comment https://forums.phpfreaks.com/topic/282025-windows-firefox-and-php-files/#findComment-1448925 Share on other sites More sharing options...
jazzman1 Posted September 10, 2013 Author Share Posted September 10, 2013 (edited) 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 September 10, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/282025-windows-firefox-and-php-files/#findComment-1448927 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.