Forum Moderators: open

Message Too Old, No Replies

File extension problem

HTML files with no extension not working correctly in Netscape

         

JonnyBoy

11:23 am on Sep 3, 2003 (gmt 0)

10+ Year Member



A quicky from a newby!

I have uploaded a few html files with no .htm extension - they are working fine in IE, but when I used Netscape to check them it opens the pages up as plain text files.

I have looked at other websites which also do not include the .htm extensions in the URL and they seem to work fine in both IE and Netscape.

Any help is very much appreciated.
Cheers,
JonnyBoy

BlobFisk

2:30 pm on Sep 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, JonnyBoy!

You should always have a file extension! It allows the browser to know how it should render the file.

While this can be got around on the server, the safest thing to do is always use a file extension. IE is quite forgiving of mistakes, Netscape is not!

HTH

JonnyBoy

2:51 pm on Sep 3, 2003 (gmt 0)

10+ Year Member



Thanks for the advice BlobFisk! I'm having one of those 'live and learn' moments. Another one.

So I just need to contact the company who hosts the website and they'll be able to rectify the problem? How do they go about sorting this out then?

DrDoc

2:55 pm on Sep 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem isn't so much the extension... The problem is that the default mime type is not text/html

The default mime type (on most servers) is text/plain. This means that if the file extension is unknown (or, in this case, omitted) it will be served as plain text... and that's what Netscape is picky about.

JonnyBoy

3:04 pm on Sep 3, 2003 (gmt 0)

10+ Year Member



Thanks DrDoc - so I can assume that the fairly large hosting company who looks after my website ain't going to be changing the default mime type to text/html because of a problem I'm having with my relatively basic website?

DrDoc

3:41 pm on Sep 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Probably not. But, are you allowed to use .htaccess files? In that case you can change that (and other things) for your site only.

Sinner_G

4:03 pm on Sep 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is there any particula reason you don't want to just add the extension? It would seem to be the easiest way to solve the problem.

JonnyBoy

4:22 pm on Sep 3, 2003 (gmt 0)

10+ Year Member



I would dearly love to go down that route Sinner_G. Unfortunately the link is now published in a book which has left me right in the turd (I wanted the URL to be as memorable as possible and had noticed that other, high profile websites include pages with no file extensions, thus assumed it would be OK)! I always check how my pages appear in other browsers, but foolishly didn't check what effect the removal of the file extension has in Netscape, or any other browsers for that matter. As I mentioned above, a 'live and learn' moment has been received.

Sinner_G

4:45 pm on Sep 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This may seem a bit far-fetched and maybe the .htaccess solution hinted at by DrDoc is easier, but you might be able to do the foolowing. Say the book says www.yoursite.com/widgets and you want it to in fact go to www.yoursite.com/widgets.htm. You could then make a new directory called widgets. If someone then enters the printed URL into their browser, it will go to that category and look for a file called default.htm or index.htm. This could either be a duplicate of widgets.htm or a redirect there.

hartlandcat

5:07 pm on Sep 3, 2003 (gmt 0)

10+ Year Member



It's not something specific about your site which means that the supposed HTML files with no file extension don't work in Netscape. It means that it's the index.html file in a directory. IE will load HTML pages regardless of the extension, nearly all other browsers most definately won't. I used to know someone that would name all her HTML files with a .txt extension...

The Golden Rule... ALWAYS test your site in Netscape or Mozilla first! They will let you know (in a visual way! ^_^) if there's some sort of error somewhere. Many people test their site and get it working in IE first, and then test it in Netscape a few weeks later as an afterthough. I could write my HTML like this and chances are it would still work in IE:

>html<
>head<
>title<My Website>/title<
>/head<
>body<
...
It would most definately NOT work in Netscape. It's really anoying how IE is so forgiving of errors, and that's why we have the myth about websites being "best viewed in Internet Explorer."

g1smd

7:58 pm on Sep 3, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




You have published an address as http://www.domain.com/somename and then uploaded a file called "somename" that does not have an extension?

To make this work, rename the file to index.html, make a folder called somename and put the file in there. Fixed. No more worries.

JonnyBoy

8:53 am on Sep 4, 2003 (gmt 0)

10+ Year Member



That's spot on gents. Thanks for all your help. Much appreciated :)