Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble intercepting AJAX (XHR) requests from GreaseMonkey script
    primarykey
    data
    text
    <p>My userscript's task is fairly simple -to listen to XHR requests via an XHR bridge sort of functionality, manipulate the data received, and return it back. Everything happening transparently, of course.</p> <p>I came across this reply <a href="https://stackoverflow.com/questions/629671/how-can-i-intercept-xmlhttprequests-from-a-greasemonkey-script/629782#629782">How can I intercept XMLHttpRequests from a Greasemonkey script?</a> on SO -- which provides the following code-snippet: </p> <pre><code>(function(open) { XMLHttpRequest.prototype.open = function(method, url, async, user, pass) { this.addEventListener("readystatechange", function() { console.log(this.readyState); }, false); open.call(this, method, url, async, user, pass); }; })(XMLHttpRequest.prototype.open); </code></pre> <p>The code works as expected when pushed via FireBug. It, however, doesn't do anything in a Greasemonkey script. </p> <p>On further searches, I came across another reply: <a href="https://stackoverflow.com/questions/688884/how-intercept-xhr-with-greasemonkey/688909#688909">how intercept xhr with greasemonkey</a> -- which mentions that:</p> <blockquote>Greasmonkey and Firefox 3.x doesn't currently support the "prototype"-property. Please see the following ticket for more information: http://greasemonkey.devjavu.com/ticket/164 </blockquote> <p>I have two basic queries: </p> <ol> <li>Does this apply to Fx v3.5.x as well? (Note: The ticket link on devjavu.com isn't accessible) </li> <li>What does signature <code>(function(){})()</code> mean in Javascript. (Kindly bear, am not an expert in advanced JS).</li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload