Create a basic html file that opens in IE

3

1

I created a basic html file and it opens fine in firefox. But in IE it just shows up as plain text (the tags are shown instead of rendered).

My file looks like this

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Testing html rendering</title>
</head>
<body>
<h1>This is a test to display html</h1>
<p>blah blah blah blah blah </p>
</body>
</html>

I feel like there is a setting wrong on my computer. Because apps that are using embedded IE controls are failing to render as well.

Any help would be great!

Thanks!

joe

Posted 2009-08-13T21:39:16.843

Reputation: 315

What is the filename? – ahockley – 2009-08-13T21:45:46.233

the filename is index.html – joe – 2009-08-13T21:49:15.820

1What is the version of IE? – Qwerty – 2009-08-18T00:25:50.590

Shouldn't this be over on Stack Overflow? – mandroid – 2009-08-18T18:24:59.560

Answers

8

This could very well be a problem in the registry.

Look for the following key in the registry editor (which I hope you're familiar with):

[HKEY_CLASSES_ROOT\.html]

Does the "Content Type" REG_SZ value exist, and if so, what is its value?

  • If it does exist, it should be "text/html".

  • If it doesn't exist, use the (Default) REG_SZ value to locate the associated file type HKEY_CLASSES_ROOT key. E.g. if it says htmlfile, look under:

    [HKEY_CLASSES_ROOT\htmlfile]
    

    If that key doesn't have a "Content Type" value either (or it isn't "text/html"), create it and set it to "text/html". That should fix it.

If you have to make that change, though, it might just be a stop-gap solution, since I don't know what actually "corrupted" those MIME types in the first place.

I also don't know if there are any other, better ways to fix this.

user2913

Posted 2009-08-13T21:39:16.843

Reputation:

You are a genious! – joe – 2009-08-18T21:08:33.473

7

Are you certain the filename is index.html and not index.html.txt or something? Windows does have a bad habit of trying to help you and get in your way at times.

Try creating the file by opening a command prompt window and typing: "notepad index.html" (without the quotes of course). You might get prompted that the file does not exist, just click yes you want to create it and then paste in that HTML you mentioned.

If that doesn't clear it up, you probably have something more seriously wrong with your mime types and file extension mappings. Try adjusting them under the Tools -> Folder Options -> File Types (under Windows XP, might be different but similar under Vista/7). It could be you have somehow associated HTML with a plain text file type.

Goyuix

Posted 2009-08-13T21:39:16.843

Reputation: 6 021

I am sure it is index.html

But I like your point about adjusting the associations. I will try it next time I get to the users computer. – joe – 2009-08-14T14:10:46.487

1My registered types look like this.

Extensions | FilesTypes HTML | HTML File

Is this right? What about the MIME types. Is there something in the registry that could of got corrupted? Thanks! – joe – 2009-08-17T22:56:44.860

1

  1. The Microsoft Windows default settings will hide the extensions of most common files (including .htm or .html). Follow these instructions to ensure that file extensions are showing. Another way to reveal the real file is to right-click on the file and click Properties. What filename is shown near the top of the Properties window?
  2. If the file is indeed appropriately named then the issue is likely to be an Internet Explorer fault. Send the file to someone with the same version of Microsoft Windows and Internet explorer to see how it behaves. Better yet, upload it to MediaFire (no account required) and we will test it for you :)

Nippysaurus

Posted 2009-08-13T21:39:16.843

Reputation: 1 223

1

Does a reset do anything?

Tools -> Internet Options -> Advanced -> Reset

hyperslug

Posted 2009-08-13T21:39:16.843

Reputation: 12 882

1

Not sure if this will help you, but adding this line within the header made it display in IE just fine for me.

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

Worth a shot.

user5992

Posted 2009-08-13T21:39:16.843

Reputation:

0

It sounds like it would be the filename having an improper extension.

When you save the file (in notepad or whichever program you choose) make sure to type the filename as "filename.html" WITH the quotes.

Joe Phillips

Posted 2009-08-13T21:39:16.843

Reputation: 1 350

0

I assume you have tried to repair/reinstall IE?

Maybe a long shot, but have you looked for adware/spyware/etc? I once encountered an adware toolbar that set itself up as a local proxy server so it could redirect all traffic to an external source which they could monitor and inject ads into the response. Because the external server couldn't reach local/intranet addresses such links failed to load properly.

Update: (uh, nevermind)

Donald Byrd

Posted 2009-08-13T21:39:16.843

Reputation: 829

0

Make sure you save as filename.htm (type out the name and extension.) If you are using notepad as your editor, make sure that the "save as type" is "all files" this will allow you to use the file extension you type (.htm) or as one of the other responders mentioned you actual file might be named file.htm.txt I ran your code and it works when saved correctly.

Warren

Posted 2009-08-13T21:39:16.843

Reputation:

0

<!doctype html public "-//W3C//DTD HTML 4.0 //EN"> 
<html>
<head>
       <title>Title here!</title>
</head>
<body>

</body>
</html>

Seems like the doc type is wrong on yours...

this link will help you with doctypes for your purposes. Make sure you also have the file named properly. If that doesn't work, keep taking out code in your html and see if it works as a debugger. if you run into a section of code where it starts to work, then you know the area where your code is breaking...

Elkidogz

Posted 2009-08-13T21:39:16.843

Reputation: 21

-1

Try adding a DOCTYPE

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title></title></head><body></body></html>

View the source of superuser.com and you'll see the same thing.

Kinda funny ... see the link at the bottom of the page - http://doctype.com/ . A site for web design questions.

Sam

Posted 2009-08-13T21:39:16.843

Reputation: 477

1Its not the doctype. – joe – 2009-08-13T21:44:40.277