[Greasemonkey] insert comment top html document

Bill Donnelly donnelly at snowcrest.net
Fri Feb 10 00:42:40 EST 2006

I want to write a GmScript that inserts a comment at the top of each
html document that contains the URL source address, so when the source
is saved, the URL of the document is automatically included for reference.

So, for example, if the top of a document has:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

I want to make it:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- source = http://www.domain.TLD/directory/whatever.html -->

I don't know if it matters if the comment is the first or second line, or
if it would be better if it was on the first or second line. (?)

I'm not particularly strong on the whole "insert a text node" stuff.
Can anyone get me started by suggesting what code would be best to
accomplish this?


Where is the OUTRAGE???
   What is WRONG with 'We The People'???
      pResidential 'elections' 2000 and 2004 (and 2008??.....)

More information about the Greasemonkey mailing list