"lotusny78@yahoo.com" <lotusny78@yahoo.com> writes:
[color=blue]
> Is it an error to have a non-existent filname in:
> <script src="scriptfile.js"></script>[/color]
Try it. Make a page and submit it to <URL:http://validator.w3.org/>.
I guess that it is not an error in itself, but that it means to
load the current page as a javascript file, which is likely to
give rise to script errors.
It is invalid HTML to have a script element without the type
attribute, so it should be:
<script type="text/javascript" src="scriptfile.js"></script>
[color=blue]
> I'm using a templating engine to compile the page, so "scriptfile.js"
> will be "" if there is no javascript for the page.[/color]
Change the template so the entire script element is omitted if there
is no javascript. That should be very simple. IF it isn't, you need a
better template engine.
[color=blue]
> Would it be better to load in the javascript with every page? Would it
> be cached?[/color]
It will probably be cached, if it is the same file for all pages that
use Javascript, *and* the server doesn't set any "don't cache" headers
when it sends it.
/L
--
Lasse Reichstein Nielsen -
lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'