Forum Moderators: open

Message Too Old, No Replies

Why Does Netscape/Mozilla modify HTML code?

         

drunk icelander

3:34 am on Aug 27, 2002 (gmt 0)

10+ Year Member



I was asked to take a look at a friends malfunctioning website and found the following malformed HTML tag:

<a href="foo" <A target="bar"> test </a>

When I opened the page with IE Explorer 5.5 and took a look at the source with the "View Source" feature this snippet of code was unchanged. But when I opened the same page with Netscape 6.1 and used the View Source feature just like I had done with IE Explorer the result was this:

<a href="foo"> <A target="bar"> test </a>

Netscape 6.1 had added a ">" symbol to the original code.

Now I know this code was sick to begin with! But that is not the point.

What I want to know, just out of pure professional curiosity, is why does the Netscape/Mozilla browser modify HTML code like this? I can't believe it is trying to correct sick HTML code!

bobriggs

3:42 am on Aug 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you've used netscape, and viewed source, you know that it 'prettiprints' the code. Tags are colored.

The fact that it has altered the missing > is probably just an artifact. IE probably does it internally, but when you view source and get it in notepad, it's only showing the actual downloaded code. So to say that Netscape altered it is one thing, but IE probably did it too (internally)

I would too if I were a browser. Here I'm expecting an end tag, but I get a begin tag. So I assume that the writer meant >.

The idea is that MORE pages will look good in your browser if you can semi-correct bad code in YOUR browser, whereas, the other browser will look bad.

drunk icelander

4:06 am on Aug 27, 2002 (gmt 0)

10+ Year Member



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

<body bgcolor="#FFFFFF" text="#000000">

<p><a href="foo" <A target="bar">test </a></p>
<p><a href="foo" ><A target="bar">test </a></p>

</body>
</html>

If you view the above code in IExplore the upper link is valid but the lower one is not. If IExplore modded the code internally both links would be invalid. Only Netscape 6/7 shows both links as unvalid, not Netscape 4.7 or Opera. Which leads me to conclude that only Netscape 6.1 mods the code, unless Netscape 6.1 reckognizes both these malformations as invalid but all the other browsers simply ignore the surpefluous "<".

PS. I debug for a living which is why this silly **** bothers me.

pageoneresults

4:17 am on Aug 27, 2002 (gmt 0)

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



Nested Links are Illegal [w3.org]

Watch out, here come the CEA - Code Enforcement Agency.

This would be the correct way...

<a href="foo" target="foofoo">test</a>

bobriggs

4:22 am on Aug 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you view the above code in IExplore the upper link is valid but the lower one is not. If IExplore modded the code internally both links would be invalid. Only Netscape 6/7 shows both links as unvalid, not Netscape 4.7 or Opera. Which leads me to conclude that only Netscape 6.1 mods the code, unless Netscape 6.1 reckognizes both these malformations as invalid but all the other browsers simply ignore the surpefluous "<".

I don't understand what you're saying.

f you view the above code in IExplore the upper link is valid but the lower one is not.

Obvious to all. That's the original post.

If IExplore modded the code internally both links would be invalid.

Depends on how it parses it.

Only Netscape 6/7 shows both links as unvalid, not Netscape 4.7 or Opera.

You had not said that before. You said that:

Netscape 6.1 had added a ">" symbol to the original code.

Did it display the links or not? Who cares about how it viewed source?

My question? What is the problem?

[added after seeing p1r post]
No I didn't even look at it. I was just looking at the < and the > and assumed wrong. Yes, we need the cops here.

PS. What is the matter with the formatting of my post?

[edited by: bobriggs at 4:27 am (utc) on Aug. 27, 2002]

pageoneresults

4:26 am on Aug 27, 2002 (gmt 0)

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



Hey, welcome to Webmaster World drunk icelander!

drunk icelander

4:45 am on Aug 27, 2002 (gmt 0)

10+ Year Member



Did it display the links or not? Who cares about how it viewed source?

This discussion could have been avoided if yhad just tried it out.

Netscape 6/7:
Both links show up none of them is clickable

Other Browsers:
Both links show up upper one is clickable lower one not.

I care about whether Netscape 6/7 renders the source it displays in "view source" because I think it would be pretty stupid to display some modified code in "view source" and then render something else. What pray tell is the point of a "view source" function if what it shows is not what gets rendered?

drunk icelander

4:45 am on Aug 27, 2002 (gmt 0)

10+ Year Member



Hey, welcome to Webmaster World drunk icelander!

Thanx, looks like a useful forum.

bobriggs

4:55 am on Aug 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This discussion could have been avoided if yhad just tried it out.

You're right about that.

I was looking for a one character error. Not an entire screwup piece of code.

It's amazing anything would render that stuff.

<a href="foo"> <A target="bar"> test </a>

<a href=> followed by <a target = ???

If I were the browser, I'd have two options.

1. Try to display it.
2. Tell you that you're an idiot.

Browsers are going to choose 1.
If they try to display it, internally, they'll modify the original code to what they think you meant, without telling you that you've made a grave mistake.

So what I'm trying to say is this:
IE will show you source in notepad - It won't show you what it changed the code to. And it will change the code.

NS is just showing you what it thought you meant.

drunk icelander

5:02 am on Aug 27, 2002 (gmt 0)

10+ Year Member



Hmmmm.....

I would prefer the browsers just try to render the code and tell me I am a moron if it is not strictly correct syntax,... kinda like a C compiler. If my C compiler went trying to guess what I menant by some sick piece of C code and did not tell me I would be pretty pissed when I started debugging. I prefer to be informed about the full extent of my galactic stupidity. :)

Netscapes guesswork cost me five minutes of my life longer than it should have to figure out what was wrong.

bobriggs

5:10 am on Aug 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The day they start doing that is the day that they lose users. Especially netscape. Needs all the help it can get.

I'm in agreement with you on the last statement because I'd LOVE to have stuff validated. But life isn't so simple. The browser developers seem to have learned all the little mistakes (along with their own proprietary code).

Unfortunately, the better a browser can display crummy code, the more popular it becomes.

Glad to have you in the forum, DI.

crash

5:16 am on Aug 27, 2002 (gmt 0)

10+ Year Member



type, in your NN address bar,

view-source:http://www.url.com

this will pull the source into notepad just like in IE

bobriggs

5:24 am on Aug 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



crash: mine just displays just like View:Source on the menu.

Is there a preference you can set otherwise?

crash

5:34 am on Aug 27, 2002 (gmt 0)

10+ Year Member



Hmm, I guess I'm wrong.. coulda sworn it pulled notepad.. been awhile since I've done a view source from NN

[wiping egg off my face]

bobriggs

5:49 am on Aug 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey don't get it off there yet. You might need breakfast tomorrow! ;)

Seriously, I can almost remember something like that. You need to edit prefs.js or somthing and associate it with something. WAY LONG AGO, though. Don't know if N6 still will support that.

crash

6:00 am on Aug 27, 2002 (gmt 0)

10+ Year Member



Ha, nahh.. eggs for breakfast?? Coffee!

Now this is gonna bug me.. I'm sure it use to pull notepad.. gonna have to fire up the old comp and see what happens there.

keyplyr

6:03 am on Aug 27, 2002 (gmt 0)

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




> Hmm, I guess I'm wrong.. coulda sworn it pulled notepad.. been awhile since I've done a view source from NN

notepad came up with IE :)

bobriggs

6:14 am on Aug 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmm, I guess I'm wrong.. coulda sworn it pulled notepad.. been awhile since I've done a view source from NN

Venerable old Netscape hates to have to run a MS program to view its source. I'm with you, though, crash, I think there's a way to get it to do it. Key is prefs.js.

Another thing about NS view source is this: it will have unraveled the javascript code in the headers, all in one line. Actually, the view souce in NS is pretty useless. You can't even copy/paste it in Win. And you're constantly horiziontally scrolling. Just my gripes.

tedster

8:05 am on Aug 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't even copy/paste it in Win.

From the keyboard: Control A, Control C, Control V

jesserud

10:06 pm on Aug 27, 2002 (gmt 0)

10+ Year Member



This is a known bug [bugzilla.mozilla.org] in Mozilla. View Source uses Mozilla's HTML parser to add colors to the source (tags are purple, etc). Since the parser doesn't keep track of things like missing >'s in tags, View Source changes some things before it displays the source. One possible fix is to use a simpler parser for colorizing the source, but see bug 57724 comment 85 for a problem with that fix.