PDA

View Full Version : getting javaScript from html



ashvindh
26th September 2010, 11:24
Hi,
I have an html doc in which some javascripts are embedded in it , i want to extract only some part of the script from html , how can i do this?

Thanks in advance
Asvindh

SixDegrees
26th September 2010, 13:57
Scan the text for opening and closing tags of the form


<script type="text/javascript">
...
</script>

and extract the scripting code from within them. You'll need to accomodate variants depending on your source, like upper and lower case, variable whitespace and so forth, but this is made easier with regular expression parsers like those provided by Qt.

There is no "gimmeJavaScript()" function, though. Although there must be something related in WebKit, even if it isn't publicly exposed. WebKit is a problem, however, because it isn't very portable; several systems and compilers are not able to build it.