faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

1 of 14 people (7%) answered Yes
Recently 1 of 10 people (10%) answered Yes


In the CODE of my JS library (*.js) how do I retrieve the URL that was used to access the file?

Apr 6th, 2008 20:00
ha mo, Colin Fraser, Scott Gartner,

Your question is somewhat vague, so I will answer it as best as I can
and hope I have it right. 
You dont. 
Brief and to the point. 
Now, what do you  want to see? The file? Easy, dump Internet Explorer
and locate a copy of Netscape 4.7x. OK it is clunky and slow and all
that, but it does a better job of supplying you with information about
the page you are accessing. 
Right click the page, click on "View Page Info"  and that will tell you
everything about the page you need. This includes all images, and what
their cache file name is, style sheets, and what their cache file name
is and remote *.js files, and what their cache file name is. Cheating?
Sure is, but for some reason it is easier to find this information in
past browsers than it is in newer ones. I must wonder why... oh well
doesn't matter. 
If you cannot get a Netscape 4.7x then look for the cache your browser
is  using, empty it out and then go to a site you want the scripting
page and open you file manager, say Windows Explorer to that cache and
look at the files that have been written to the cache. Open each one
with a text editor, one will be the file you are looking for. If this
does not make sense then you may try the next thing. 
Open the site you want, then do a right click and look at the code. In
the head data there should be a reference to the script file it uses.
Once you have that, then copy it, paste it to the address or location
bar of your browser and look at the results. 
One of these solutions will work for you, however, getting the file you
want is not the real problem. Once you have the file, then you have to
make sure that you understand the code that is written into that file.
That is the real hard part, so if you fall at the first hurdle, you
certainly will not make it over the second.... 
Good luck..