Feedback on: irt.org FAQ Knowledge Base Q820
Worth:
Not worth reading
Comments:
It doesn't work in Netscape
and IE. I got a syntax error.
Technical:
Not technical enough
Comments:
This solution doesn't work when writing standalone JavaScript files.
Worth:
Not worth reading
Technical:
Not technical enough
Comments:
I have .html file called "one.htm" that calls .js file "one.js". I want to include file "two.js" from within "one.js". This solution doesn't work. All I get is syntax errors in IE 5.5 and NS 4.78
Worth:
Not worth reading
Comments:
The syntax of the suggested solution is incorrect in two distinct ways.
1. It says to use HTML <script> tags within a .js file.
2. The script syntax is wrong, as there is an unmatched single quote which makes the author's intent quite unclear.
Worth:
Not worth reading
Length:
Too short
Technical:
Not technical enough
Comments:
I don't think this will work unless the poster meant to say to put this in the HTML document. However, that doesn't answer the question. Has anyone tested this answer and gotten it to work?
Worth:
Not worth reading
Comments:
Will not work if file 1 is dependant on variable/class defined in file 2.
(For example, you are writing a script that requires browser detection, and you use this technique to include such a script. It won't work)
Worth:
Worth reading
Length:
Just right
Technical:
Comments:
Works fine, only the <script> tags should left out in the .js file.
Tested it with MSIE6, Opera 8.02, Netscape 7.2, Firefox 2 today,
and it all worked, even without the broken '<scr' + 'ipt src...' suggestion.
Inside the one and only js file included in the document
there is a browser detection and then I do an include of the right implementation for the current browser like this:
document.write('<script src="implement_'+ browsercode +'.js"></script>');
Thats it!