开发者

Change page before show

开发者 https://www.devze.com 2023-01-09 05:50 出处:网络
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..

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消