[Greasemonkey] halting navigation via Javascript
Lenny Domnitser
ldrhcp at gmail.com
Wed Oct 5 18:45:59 EDT 2005
On 10/5/05, chris feldmann <cfeldmann at gmail.com> wrote:
> tiddles? This esoteric jargon is beyond me! BUT, you could iterate
> through the page with an xpath query and add an event listener to all
> the anchor elements. Then preventDefault() and have your way with
> them. Maybe add a confirm()?
It's a one-liner. No need for a confirm()--this automatically prompts
the user whether they really want to stay on the current page:
addEventListener('beforeunload', function(e) { e.preventDefault(); }, false);
More information about the Greasemonkey
mailing list