
![]() |
cdc
Sorry for the hiatus. VS pointed me to a thread here and I now realize what I've been missing all these months...
And here comes the first of many dumb questions! Let's say that I have a page with the following code: <script id="cdc" src="/myscript.js"></script> I'd like to be able to access the contents of myscript.js on the client side. In other words, I'd like to do something like: var thescript = document.getElementById('cdc').innerHTML; Except innerHTML doesn't work because there isn't actually anything in the script tags. Is there a way for me to access the contents of myscript.js? perkiset
Heh... a barely veiled hack my friend
![]() I have tried in vain to do that. Script is pulled down and loaded directly into the interpreter, not into the DOM, so you cannot get at it in a programmatic way. Is this a legit exercise that we can discuss different ways to go about something, or was it of darker origin...? cdc
darker, of course.
![]() But thanks for the answer. Now I won't waste any more time trying to get it to work. Back to the drawing board. DangerMouse
I can't imagine any reason why putting the
javascriptyou require into xml format (may work with raw strings forgoing DOM style access but still putting the content into a var), then calling it with xmlhttprequest wouldnt work?DM cdc
Unfortunately, I don't have control over the format of the JS that I'm calling.
I imagine it's the same story with iframes...no way to get the contents of what is brought back from the src attribute? perkiset
That is correct, but iFrames are protected under a security context - so the data is on the DOM, you just can't get to it. You may find some success talking to JasonD, who has spent a good deal of time in this arena. No idea of his success, but it's right up his alley
![]() |

Thread Categories

![]() |
![]() |
Best of The Cache Home |
![]() |
![]() |
Search The Cache |
- Ajax
- Apache & mod_rewrite
- BlackHat SEO & Web Stuff
- C/++/#, Pascal etc.
- Database Stuff
- General & Non-Technical Discussion
- General programming, learning to code
- Javascript Discussions & Code
- Linux Related
- Mac, iPhone & OS-X Stuff
- Miscellaneous
- MS Windows Related
- PERL & Python Related
- PHP: Questions & Discussion
- PHP: Techniques, Classes & Examples
- Regular Expressions
- Uncategorized Threads