Peter Michaux wrote:
On May 6, 1:35 pm, Steve <tinker...@gmail.comwrote:
>I've being going through some legacy code on an old JSP site I have
been patching. I noticed that when I save the JSP down to my PC as an
HTML file I get this javascript error in IE 6 ( not in the latest
Firefox ):
"invalid character"
The problem traces back to this line of code:
<SCRIPT TYPE="text/javascript" SRC="abc/jsp/blah.js"></SCRIPT>
It goes away if I remove the "text/".
That is strange. I've never had a problem. Is the "blah.js" file in
some strange character encoding?
That would not matter, unless we are talking a misconfigured local Web
server here which appears to be unlikely from the OP's description.
Instead, it is very likely that the OP only stored the JSP and not the
script, or they did not store it in the path where it belongs according to
the above `script' element.
>What is <SCRIPT TYPE="text/javascript" used for? Is it necessary?
This is a bit of a tricky area. In mid 2006(?) the official type was
approved as "application/javascript" however everyone had been using
"text/javascript" and so there will be a transition period before
using "application/javascript" is the norm.
Will you please get that right eventually? RFC4329 cause the registration
of four media types for ECMAScript implementations, two especially for
javascript
:
http://pointedears.de/scripts/test/mime-types/
Also HTML 5 is almost surely the future of the web.
Wishful thinking.
XHTML just didn't have a good chance with how strict it is and without support in
Internet Explorer, I guess.
Quite the contrary. XHTML is continuously gaining speed on the Web despite
that because people use XML-compliant tools to generate it and serve it to
IE (and, unfortunately XHTML-compliant UA as well) as text/html instead.
While that practice surely is debatable, it is a development reality.
For example, we are mainly developing Plone-based Web sites (a decision made
by one of my predecessors that I have to live with). A Zope Page Template
(ZPT) that is required for efficient templating there (one wants to avoid
DTML for non-trivial templates) is an XML application, and if HTML code is
to be included it has to be XHTML or the template simply won't compile. So
I have to serve Appendix-C-compatible XHTML 1.0 Transitional as text/html
for those sites, knowing that I am relying on erroneous error-correction on
the part of user agents.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>