Forum Moderators: open

Message Too Old, No Replies

External JS files across browsers

if you're really concerned about cross-browser compatibility

         

annetallant

12:20 pm on May 17, 2004 (gmt 0)

10+ Year Member



I've read so much about cross-browser compatibility and external js files, I've gotten lost. I've read some browser versions can't read external js files. If that's the case and you're worried about cross-browser compatibility, then it seems you shouldn't put your javascript in external files. But I've also read that you shouldn't make SE crawlers wade through a bunch of javascript code, if it isn't content relevant. So what are you supposed to do?

And what if you need a Javascript function call inside a table? Netscape 3 has a problem with this. Other than terminating the call with a semicolon, how else do you ensure that Netscape 3 will handle the javascript (assuming of course it's enabled)? Or do you write Netscape 3 off?

Bernard Marx

1:25 pm on May 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What's Netscape 3?

choster

1:26 pm on May 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think most people write Netscape 3 off-- we were forced to write it off years ago because its security certificates expired in 1999. In fact, you'll find a number of developers here who have also written off IE 4 and Netscape 4.

Rambo Tribble

3:28 pm on May 17, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Since Netscape 4.08 will run even on Windows 3.1, it is unlikely that NS 3 has any adherents left, to speak of.

bumpaw

1:28 am on May 18, 2004 (gmt 0)

10+ Year Member



Does anybody have a link to a good reference for browser compatibility. I'm brand new to JavaScript and I hear mention of the different versions of JavaScript and their effect on different browsers. What I could find didn't seem at all current. I have a real thorough looking tutorial based on JavaScript 1.0 and it talks about it being compatible with IE 3.0 and higher. Is this to dated to learn with?

I'm also wondering if there is anybody equivalent to the W3C that sets standards?

Bernard Marx

1:57 am on May 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm also wondering if there is anybody equivalent to the W3C that sets standards?

Yes there is, it's called ECMA. JavaScript, and JScript (MS's implementation) largely cover all it's core recommendations, then add a few bits of their own on.

If you look closely at JavaScript, you'll find that there isn't much difference between the browsers - core JavaScript that is. The differences come in areas that ECMA doesn't set out to standardize. Things like browser objects (up to the producer), and document objects (W3C)

with IE 3.0 and higher. Is this to dated to learn with?

Possibly. As Rambo pointed out, there's no particular reason for anyone to use NS3. Whether you want to learn to handle Netscape 4, considering that later Netscapes and Mozillas aren't updates, but more like total overhauls, is really up to you.

My advice (for what it's worth) is to target ver5+ browsers, at least while you're getting into your stride.

Does anybody have a link to a good reference for browser compatibility?

Here are the 'official' tables. Note that MS JScript has a different versioning system (that's why it's best not to put the version in the <script> tag). I can't offhand find any correlation table.

Netscape:[devedge.netscape.com ] - half-way down the page
MS JScript:[msdn.microsoft.com ]

These suggest that you should try at least v1.3 . Many of the newer additions are quite arcane, or slightly more advanced things like try .. catch blocks, which you needn't get into yet anyway.

The main compatibility issues are in the broader area of DHTML scripting in general. Try [quirksmode.com ]

..or come here, and ask for RamboTribble personally.

Rambo Tribble

2:26 am on May 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, no, ask for Bernard Marx. He's the one.

Parenthetically, I'd agree with him that anything prior to JS 1.3 is a bit on the archaic side. There are, however, some scripts that rely on the peculiarities of JS 1.2. As for try/catch blocks, for me they make more sense in Java, where you have a more structured exception handling scheme. JavaScript's try/catch/finally is basically a copy of Java's implementation of the concept, but stripped down a bit. O'Reilly's JavaScript: The Definitive Guide does a nice job of explaining the JS implementation and is an excellent reference on the language.

Probably the most significant enhancements to the JavaScript language in the later versions are the facilities for manipulating the DOM (document object model), an essential part of DHTML. In essence, real DHTML wasn't possible until version 4 browsers.