I'm developing a mozilla Add-on, and i would like to know, how to change a page that is requested by ajax before the response be sent..
Let's say that in stackoverflow i have a button and when i click call this function:
h = new XMLHttpRequest();
h.open("GET", "somepage",true);
h.onreadystatechange=function() {
if (h.readyState==4) {
alert(h.responseText); //I want change this result before the javacript alert the content...
}
}
h.send(null)
I hope you understand my que开发者_开发知识库stion... the site which a want to change works all with ajax, and i didn't find another way to change the content without change the response in ajax.
Thanks :)
You need to register an observer for the http-on-examine-response event and then modify the response before it's interpreted by the browser.
精彩评论