[Greasemonkey] extract from <script> tags...

Nikolas Coukouma lists at atrus.org
Wed Jul 13 16:46:57 EDT 2005

decembersoul wrote:

> Hello
> I want to make a skript to filter out and send to DB some infos from a
> Page.
> My Problem is that the information are in SCRIPT Tags.
> <SCRIPT language=JavaScript>
> wrtg("blablabla");
> </script>
> I want to extract the "blablabla" and send it to a DB.
> How can i get the infos?
> I have written some java progs but never a javascript :-(
> Sorry if this is the wrong mailinglist.
> Patrick 

First of all, Java and Javascript are completely different languages, so
you might want to start by reading a primer/tutorial/etc on it.
Secondly, "sending it to a DB" requires that you have a web service of
some sort that actually inserts into the database, because you can't do
it from Greasemonkey directly (medium-privileged JS). You should also
look up "DOM"

vaguely, your script should look something like:
scripts = document.getElementsByTagName( "script" );
for( var i = 0; i < scripts.length; i++ ) {
  contents = scripts[i].innerHTML;
  // do something with the contents

-Nikolas Coukouma

More information about the Greasemonkey mailing list