html - Javascript: is it possible to read the raw code of external scripts? -
given typical script tag:
<script src="foo.com/myscript.js"></script>
would possible directly read contents of myscript.js
string or something?
example:
<script id="myscript" src="foo.com/myscript.js"></script> <script> var inners = document.getelementbyid("myscript").//raw contents of myscript.js </script>
no. can read contents of inline script tag, because have content:
<script id="myscript"> var inners = document.getelementbyid("myscript").textcontent; </script>
but external js, script contents not put dom; need re-fetch using ajax (it cached unless anti-caching measures taken, not take time re-fetch).
Comments
Post a Comment