Jump to content

Extracting Javascript Source from IE


RickyD
 Share

Recommended Posts

I have a web page that I need to get some information from. I've been successful for any information that is actually part of the HTML page (table entries, links, etc.)

However, there are a couple of pieces of information that the server side has embedded into an external javascript file. "DebugBar" shows me the script contents, which is how I found what I needed in the first place. I can get the URL of the javascript source file from the document.scripts DOM collection. However, I can't figure out how to read the contents of the script into AutoIt. I've played with InetGet() but haven't had any luck. Is there a way to get the script source directly out of IE?

Thanks,

Rick

Edited by RickyD
Link to comment
Share on other sites

The scripts are not included in the data from _IEDocReadHTML()? Note that is not _IEBodyReadyHTML().

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

The scripts are not included in the data from _IEDocReadHTML()? Note that is not _IEBodyReadyHTML().

:mellow:

No, since they are external scripts. All I seem to be able to get is the URL of the script file, not the script text itself.

Rick

Link to comment
Share on other sites

No, since they are external scripts. All I seem to be able to get is the URL of the script file, not the script text itself.

Hmm. I would have expected that to be prevented from working by cross-site scripting protections. But I'm not a web guy.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Here's some magic...

$sScriptText = $oIE.document.parentwindow.eval("decodeURI('" & $sFullJSFileURL & "');")

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...