-1

I included external javascript file in my page using usual script src = "myjs.js" - Can I assume that javascript code should become part of DOM Now ? Can I Parse dom to get javascript content in a var ?

I dont want to use HTMLHttpRequest and want to use in simple javascript i.e. no dojo or jquery either. Can any one tell me is it possible if yes I will appreciate if you could help me figuring this out .

The core of the question is I want to spit out the javascript on my page which is included in script tag under head tag - I want to do it without try to load the .js again i.e using HTMLHttpRequest.

Thanks in advance.

1

1 Answer 1

0

No, the text of a script loaded from a file is not included in the document.

You can get the literal text (if the script shares the domain of the page) with the textContent of an AJAX call, which won't download it again, but will serve it from the cache.

You could include the script literally in the html, and use scriptelement.text, if you really have a dispise for XMLHttpRequest, which you may mean when you refer to HTMLHttpRequest.

Sign up to request clarification or add additional context in comments.

1 Comment

Thnx 4 reply n Sorry for my bad,I indeed meant XMLHttpRequest.Yes the problem is page dont share the same domain,infact it is a desktop application which has IE embeded in it my script file which i use to render the page is in the same directory where the page is served from the first Time. The problem is that application provide a copy feature of the page and when user click on the copy page is saved on another directory and my script is not reachable any more. I want the script back so can make use of it.How? there is complicated way but 1st thing that i need to get hold of script.thnx again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.