faqts : Computers : Programming : Languages : JavaScript : Document

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

3 of 7 people (43%) answered Yes
Recently 3 of 7 people (43%) answered Yes

Entry

how can I view the source (content) of a file included via <script src=xxx></script>?

Sep 4th, 2001 06:43
M Flaming, Joe Lipman, Jean-Bernard Valentaten,


DETAILED QUESTION:
I'm not trying to view the source of an included .js myself: what I'd 
like to do is have another script on the page parse an included .js -- 
something like:
<script id=script_to_parse src=xxx.js></script>
<script>
var scriptContent = document.body.script_to_parse.innerHTML;
</script>
...although of course this doesn't work.
What exactly do you want to do???
My guess is, that you've seen some cool js-action on a page and wante 
to know how they've done it. So you've taken a look at the page-source 
and noticed that the js for that is in an external file.
Now you want to know how to take a look at that, isn't it???
If it is that what you want ... figure it out by yourself, if you meant 
something different, please specify what you wanted.
-----------------------------------------------------
What I do is simply type the URL of the js file into the browser, which 
by default prompts to save it to disk.  Then just use notepad (or other 
text-editor) to open it.
ex: if microsoft.html includes 
    <SCRIPT LANGUAGE="Javascript" SRC="/scripts/toolbar.js">
    Then 'http://www.thecompany.com/scripts/toolbar.js' should retrieve