[Greasemonkey] New User Script: post-interceptor.user.js

Jeremy Dunck jdunck at gmail.com
Mon Apr 18 16:51:10 EDT 2005


On 4/18/05, Prakash Kailasa <pk-moz at kailasa.net> wrote:
> The script intercepts POST requests resulting from the matched
> pages, and displays a popup window showing all the POST
> parameters that would have been sent to the server. Clicking
> on the value of any parameter would enable the user to
> edit/modify the value. User has the option of sending the
> modified form, original form or cancel the submission
> altogether.

Hmm.  Not working as described for me.
On google.com, after enabling interceptor, I get a popup showing the
submit values.

However, after only a moment, the page apparently posts anyway,
transitioning as normal.

I think the problem is that you're returning false from a listener,
when you really mean evt.preventDefault().

I've changed this:
	// define our 'submit' handler on window, to avoid defining
	// on individual forms
	window.addEventListener('submit', function(e) {
				    interceptor(e); 
				    return false;
				}, false);
    }

to this:
	window.addEventListener('submit', function(e) {
				    interceptor(e); 
				    e.preventDefault();
				    return false;
				}, false);
    }

And that gave the expected behavior.
If it's useful, I'm on Windows 2000 running FF 1.0.2.


More information about the Greasemonkey mailing list