Greasemonkey & http-on-modify-request

2.2k views Asked by At

I'm researching on writing some JavaScript code that tampers with HTTP POST requests and responses. Since the code I want to write is largely a proof-of-concept, a Firefox extension is too much I think (plus I would prefer to not deal with all that wrapping and over-SSL restrictions). I wondered then if I could write it as a Greasemonkey script. My question therefore is this:

Can you use Mozilla's event observers (http-on-modify-request etc) under Greasemonkey ?

Please have in mind that I learned what JavaScript is 10 minutes ago and I don't have any experience in that domain. However I believe this is within my skills and with a little research and stubbornness I can implement it. Though I worry about trying to make something work in an impossible way.

Thanks!

George.

1

There are 1 answers

2
Brock Adams On

No, Greasemonkey scripts do not have access to XPCOM components. With the exception of the GM_ functions, Greasemonkey scripts can only do what ordinary JavaScript does.

You can usually intercept AJAX calls by overwriting XMLHttpRequest() -- see question 629671. Beware that there may be interference from JS libraries that the page may use.