[thelist] External Javascript files (+check this out?)

Sam-I-Am sam at sam-i-am.com
Thu Oct 25 15:28:20 CDT 2001


> I should've tested an external .js file which was working - I forgot the
> mimetype and just guessed. :-(

ah. good catch (he says as he scurries to fix a couple of scripts that
*seemed* to work most of the time :)

maybe this thread is a good a place as any to get comments on this:

http://sam-i-am.com/testsuite/samstests/dynamic_tree_from_xml_data_file.html

this is just a demo for my own purposes (curiosity, learning, idleness)
and like I say on there, its not really practical out of the box..(slow)
but there's some goodies in there. In particular I like the cgi that
spits out js string variable assignments, given a url. I've used it a
few times already just for creating javascript-ified strings of file
contents. 

it'll take 3 arguments
url (required -- full absolute url)
vname -- the name of the javascript variable in the assignment which
gets returned
mime -- mimetype. It defaults to application/x-javascript (now :), but
you could set text/plain for example 
e.g
http://sam-i-am.com/cgi-bin/sendasjs.cgi?url=http://evolt.org&vname=sEvlt&mime=text/plain

the xml parser is from http://www.jeremie.com/Dev/XML/ .. my code just
builds the leftnav from the objects (node tree) it produces

Sam




More information about the thelist mailing list