...

View Full Version : Code displaying in IE instead of webpage



Goldmare
08-10-2007, 07:00 AM
Well, I always knew I hated IE for a reason... :mad:

My latest problem is rather unusual, however. I have created an online art and photography portfolio for my mother, and have temporarily located it here: http://geaw.atspace.com/

(Since I have no idea exactly what part of the coding is the problem, I request that you view the site yourself to see the coding... I don't want to clutter up the page by posting all my XHTML and both stylesheets.)

It works beautifully in Firefox, Opera, and Netscape.

IE doesn't just screw it up (well, it did, but I have a separate stylesheet with hacks to solve that), instead, it just doesn't display it at all! What it displays is the code itself, as if you had hit the "View Source" button.

This is the same in IE7 and IE5.5, according the NetRenderer.com, so I assume IE6 is as well (for some reason NR gave me an error when trying to show version 6).
Also, Avant, being that it uses the same engine as IE, has the same problem.

The weirdest part, is that my local copy of the website works fine (with the hacks) in IE. It is only when I actually upload it to the Internet that it breaks.

I've tried a number of things with the code, even changing the doctype, but nothing affected it at all. :( So I simply added a bit to my comment at the top of my code, warning visitors that they will need to use Firefox, Opera, or Netscape in order to view it.
(This is not a problem, as this is the temporary location, and I have only shown the link with the intention of getting opinions on the design. I'm not expecting clients just yet.)

It's something that utterly baffles me. :confused: I don't even know if the problem deals with the XHTML or CSS! The site is 100% valid XHTML 1.0 Strict and valid CSS.
It still works in other browsers, so it can't be the host's fault.

My poor head is so confused. I need help... T_T

garydarling
08-10-2007, 07:57 AM
I copied your exact code (minus the style sheet) to my web server and got the same results as you in IE7; raw xml code.

I then created a new xhtml strict barebones document in Dreamweaver, and copied all your content from just below the <html> tag thru the </html> tag to this new page and uploaded it... and it looks perfect. Go figure.

http://www.garydarling.net/geaw.html

http://www.garydarling.net/geaw2.html

Goldmare
08-10-2007, 03:02 PM
Huh. I checked the source code of both, and the only difference is that the second one is missing the big comment at the top.

I guess that must have been the problem (though why in the world it's a problem is beyond me).

Thanks. :) I'm going to try removing the comment from my original coding and see if it works for me.

*Jeopardy music plays*

Yep! That was the problem! And when I replace the code, but put it after the <html> tag, it also works fine.

I guess, for some reason, IE just doesn't like comments being placed before the <html> tag. *kicks IE* Bah. Why the local copy worked is still a mystery... but whatever.

(Why didn't I think to try that...? Oh well.)


Thanks again! :D

koyama
08-11-2007, 04:59 PM
http://www.garydarling.net/geaw.html

http://www.garydarling.net/geaw2.html
Hmm... Looks like the style sheet is not loading?

I guess, for some reason, IE just doesn't like comments being placed before the <html> tag. *kicks IE* Bah.
It seems like you don't know about quirks mode (http://en.wikipedia.org/wiki/Quirks_mode#Comparison_of_document_types).

If you insert comments and stuff before the document type declaration then you may be triggering quirks mode in IE6/7.

There are differences when and when not quirks mode is triggered in various browsers. I believe the following holds true:

White space before the document type:
IE6, IE7, Firefox: does not trigger quirks mode

<!-- comments --> or any stray characters before doctype:
IE6, IE7: triggers quirks mode
Firefox: does not trigger quirks mode

with an xml declaration before the doctype
IE6: triggers quirks mode
IE7, Firefox: does not trigger quirks mode

Therefore, if you want standards mode in all browsers, then, generally, never put anything before the document type declaration. (And be sure to pick a document type that triggers standards mode)

Goldmare
08-12-2007, 12:29 AM
Hmm... Looks like the style sheet is not loading?
He purposely left out the stylesheets so as to focus purely on the html. :)


It seems like you don't know about quirks mode (http://en.wikipedia.org/wiki/Quirks_mode#Comparison_of_document_types).
Well, I do know about quirks mode... we went over it when I took a web developer course in college. They did not, however, explain that there were certain things you could do to accidentally trigger quirks mode. They really should have... -_-


If you insert comments and stuff before the document type declaration then you may be triggering quirks mode in IE6/7.
Well, that's annoying. However, the error I was receiving had nothing to do with which mode it was in... and besides, my comment wasn't before the doctype at all. It was between the doctype and the <html> tag (which was the actual problem).


with an xml declaration before the doctype
IE6: triggers quirks mode
IE7, Firefox: does not trigger quirks mode
Hm? But the xml declaration is supposed to go before the doctype, isn't it? (I've found that, if you put anything before the xml declaration, W3C's html validator complains mightily, so you can't put it after the doctype...)

Although, I have no way of testing the mode in IE6, since I have IE7.

koyama
08-12-2007, 01:13 AM
Hm? But the xml declaration is supposed to go before the doctype, isn't it?
It is, but you can't use it if you want standards mode in IE6. But the xml declaration is not required, so leaving it out shouldn't be a problem.

The real question may be why you are even using (fake) XHTML. Strict HTML may be the correct choice:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Read what Arbitrator has to say about fake XHTML: http://codingforums.com/showpost.php?p=569539&postcount=9


Although, I have no way of testing the mode in IE6, since I have IE7.
Besides being rendered in quirks mode there are rendering issues in IE6. I captured a screen shot (http://www.koyama.dk/demos/CF121054/CF121054.png) for you. The background is partly missing.

Goldmare
08-12-2007, 05:19 AM
The real question may be why you are even using (fake) XHTML. Strict HTML may be the correct choice:


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Read what Arbitrator has to say about fake XHTML: http://codingforums.com/showpost.php?p=569539&postcount=9
Point taken, but I am so used to XHTML, that I simply use it out of habit. I'm not sure if I even remember how to write in proper HTML. ^^; Does it matter?



Besides being rendered in quirks mode there are rendering issues in IE6.
Ah, that I already knew. I use NetRenderer for that. (When I was still experiencing the original error, it wouldn't take a screenie in version 6 for some reason, but it works now.)

The rendering problem was occurring in IE7 as well, but I came up with a hack that solved the issue. For some reason, the hack isn't working for IE6 or IE5.5. I really don't know why, but I'm working on it. Thanks for letting me know anyway. :)

It is for reasons like this that IE is hated... I wish people would wake up and start using Firefox or Opera. Even my mom uses IE. :( Alas...

crypthacks
08-12-2007, 05:25 AM
IE strikes again! ;/



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum