【发布时间】:2012-06-20 12:56:25
【问题描述】:
我有一个 chrome 扩展程序,它在网站上进行了一些更改(编辑 cmets)。
在网站最近发生更改后(网站不是我的) - 评论块使用 ajax 加载(之前是简单的发布请求并重新加载整个页面)。
现在,如果我第一次加载页面 - 内容脚本可以工作,但是当我转到下一页时,比如第 2 页 - 使用 ajax 添加 cmets 并且不再运行扩展脚本。所以 cmets 并没有按照我想要的方式改变。
有什么简单的方法可以监听页面变化 DOM 并再次应用扩展脚本?
在我的清单文件中:
{
"name": "Name",
"version": "1.0",
"description": "Description",
"icons": {"16":"16.png",
"48":"48.png",
"32":"32.png",
"128":"128.png"},
"browser_action": {
"default_title": "Default title",
"default_icon": "48.png",
"popup": "popup.html"
},
"permissions": [
"tabs",
"http://www.site.com/*",
"notifications",
"unlimitedStorage"
],
"options_page": "options.html",
"background_page": "background.html",
"content_scripts": [
{
"matches": ["http://www.site.com/*","https://www.site.com/*"],
"js": ["jquery-1.7.1.min.js","content.js"],
"run_at": "document_end"
}]
}
【问题讨论】:
标签: ajax google-chrome google-chrome-extension