在显示之前更改页面

时间:2010-07-29 19:30:21

标签: firefox firefox-addon

我正在开发一个mozilla附加组件,我想知道,如何在发送响应之前更改ajax请求的页面..

假设在stackoverflow中我有一个按钮,当我点击调用此函数时:

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)

我希望你理解我的问题...... 想要更改的网站全部使用ajax,我没有找到另一种方法来更改内容而不更改ajax中的响应。

谢谢:)

1 个答案:

答案 0 :(得分:0)

register an observer事件需要http-on-examine-response,然后在浏览器解释之前修改响应。