homepage Welcome to WebmasterWorld Guest from 54.226.80.55
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
W3C Validator Error Help
using TYPE in a script tag for javascript 1.2
tesla




msg:1484033
 4:50 pm on Sep 11, 2002 (gmt 0)

In using the w3C validator, I keep getting the error below. The Error Arrow, which I removed, was pointing at the ">"

What does "TYPE" Mean"? What is it looking for?

<script language="JavaScript"><!-- stuff
Error: required attribute "TYPE" not specified

Here is another one:

<script LANGUAGE="javascript1.2"><!-- stuff
Error: required attribute "TYPE" not specified

 

bobriggs




msg:1484034
 4:55 pm on Sep 11, 2002 (gmt 0)

add type="text/javascript" into the script tag.

And you don't need the language attribute.

tesla




msg:1484035
 5:02 pm on Sep 11, 2002 (gmt 0)

What would I do with

<script LANGUAGE="javascript1.2">

Does this become:

<script type="text/javascript">
OR
<script type="text/javascript1.2">

bobriggs




msg:1484036
 5:03 pm on Sep 11, 2002 (gmt 0)

The first one.

<script type="text/javascript">

pageoneresults




msg:1484037
 5:16 pm on Sep 11, 2002 (gmt 0)

> And you don't need the language attribute.

bobriggs, are you sure of that? The reason I ask is because that is 4 more bytes of code that I can eliminate from my pages and before I do so, I want to make sure.

bobriggs




msg:1484038
 5:23 pm on Sep 11, 2002 (gmt 0)

[w3.org...]

Deprecated because there is no standard.

You might need a netscape 3 version for this to make any difference, but I think it would be backwards compatible anyway. (It would just ignore any script elements that it didn't know what to do with), but in that case, your script wouldn't work anyway.

[added]
If you do specify Javascript1.2 as a language attribute, this will keep NS3 from trying to execute it. There's a table on this page:
[developer.netscape.com...]

I don't think IE pays any attention to it. I also read somewhere else but can't verify it that if the src= attribute is used, the language attribute is ignored anyway.

pageoneresults




msg:1484039
 6:20 pm on Sep 11, 2002 (gmt 0)

Thank you very much for the references bobriggs. The savings was 22 bytes per page from my <head> sections. We are currently micromanaging our code to trim out as much as we possibly can. Little tips like this add to the totals.

We've converted all of our external javascript references to this...

<script type="text/javascript" src="http://www.domain.com/javascript/file-name.js"></script>

We use absolute URL's for external file references. You can also use relative.

P.S. This is one of those times when the FP Find and Replace feature comes in handy. ;)

rewboss




msg:1484040
 7:07 pm on Sep 11, 2002 (gmt 0)

Note that specifying language="JavaScript1.2" makes Netscape 4 behave differently. In particular, the equality operator == returns false if the operands are of different data types (so 1=='1' returns false in NS4 with JavaScript1.2 specified, but otherwise it returns true), and some array and string handlers behave differently.

In other words, specifying JavaScript1.2 will cause NS4 to be even more incompatible than usual.

dingman




msg:1484041
 4:17 am on Sep 12, 2002 (gmt 0)

Given that using the "Language" attribute on a style tag is deprecated, does anyone here know of a way to specify Javascript versions without using it? I have some scripts for a site I work on that almost certainly won't work in older versions of the language, but it would be just fine to leave them out. However, I'm writing to the XHTML Strict DTD, which means no "Language" attribute for me. Would something like type="text/ecmascript" both work and keep older browsers from trying to execute my code?

bobriggs




msg:1484042
 4:29 am on Sep 12, 2002 (gmt 0)

No, the older browsers were looking for the language attribute. And I mean really old. Which JS version are you using?

I have some scripts for a site I work on that almost certainly won't work in older versions of the language

I know I'd like to support all possibilities, but when's the last time you saw a real Netscape 3 browser come by your site?

Unless you're trying to support Netscape 3 browsers, I wouldn't worry about it at all. It's really just a netscape thing anyway. Javascript1.2 started with the 4.0 browsers. If you're using 1.3 capabilities, it still should not matter unless you're worried about the early NN4 versions choking. But weren't Navigator 4.0-4.05 the beta numbers anyway?

dingman




msg:1484043
 5:39 am on Sep 12, 2002 (gmt 0)

> when's the last time you saw a real Netscape 3 browser
> come by your site?

On my tiny little two-domain server with about 30 users and no reason for anyone else to show up? They all look like lying crack attempts. (and against the wrong operating system, no less)

The system I'm concerned about, however, has a significant portion of its users in Africa. I don't have access to the logs, but the people I work with/for assure me that not all the site's users have access to modern software and hardware.

I think that the compatability issue may well be as much DOM support as Javascript language features, but to be honest I know nothing about Javascript that I haven't learned from a couple of O'Reilly books in the past three weeks. I've always done everything server-side until my boss asked for DHTML menus. If you are interested, I can paste or mail the code I've written - it's three fairly short functions plus some style rules, and they work in Gecko and IE6.

As far as early NN4, I'm afraid I'm too young as a computer person to really recall. About that time, I was using Mosaic as a way to cut past the cruft on other peoples' sites and not paying much attention to NN, IE, and the browser wars. I also thought I'd never touch HTML until there were pleasant WYSIWYG editors for it, which is amusing in light of the fact that I now write everything in Emacs.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved