How can I get the content of the file specified as the 'src' of a <script> tag?
javascript
Solution
Do you want to get the contents of the file http://www.example.com/script.js? If so, you could turn to AJAX methods to fetch its content, assuming it resides on the same server as the page itself.
Problem
If I have a script tag like this: ``` <script id = "myscript" src = "http://www.example.com/script.js" type = "text/javascript"> </script> ``` I would like to get the content of the "script.js" file. I'm thinking about something like `document.getElementById("myscript").text` but it doesn't work in this case.