[Greasemonkey] Alternative script injection technique proof of concept

Bill Donnelly donnelly at snowcrest.net
Sat Jul 23 02:36:07 EDT 2005

I was going to reply the same.

I recently changed one of my scripts to use the "delete ..." feature.

It is an easy way to stop people from grabbing functionality in
an attempt to stop you from doing something.
And it does not cause an error if the value has not been redefined.

So, any time you REALLY want to make sure that someone hasn't
redefined some function/method or property/field, just delete
the reference to it and you are ensured that you will get the
real, native value.

This is good to know.

I just remembered what I used it on. I modified the Shell 1.3
bookmarklet code to first "delete window.open;", because a site
I was looking at had redefined it, so the Shell wasn't opening
in a new window, it was replacing the document in the current
window, which defeats the purpose of what you are trying to do
by using Shell. (to look at the document JS values and DOM)

The site in question was grabbing context-menu right-clicks to
"stop" you from grabbing their images. (an irritation, really)
I wanted to look at the site while converting my "re-menu"
bookmarklet into a GmScript to combat any site that attempts
to do that. It is in alpha right now, but I will publish it soon.
It seems to work well.

Jack the Ripper may have been quite insane,
but he had beautiful penmanship.
btw -- Don't look back!
The lemmings are gaining on you.

More information about the Greasemonkey mailing list