如何编写一个简单的 Chrome 扩展内容脚本来执行 JavaScript(例如alert("hello");
在每次页面加载时执行 JavaScript(例如)?
因此,当我导航到页面或重新加载页面时,JavaScript 应该运行。
manifest.json
到目前为止,这是我的文件:
{
"name": "Highlight some phrases",
"description": "Hightlight some pre defined text from websql database after page loads",
"version": "0.1",
"permissions": [
"tabs","<all_urls>"
],
"browser_action": {
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"content_scripts": [
{
"matches": [
"http://*/*",
"https://*/*"
],
"js": ["content.js"]
}
],
"background": {
"page": "background.html"
},
"manifest_version": 2
}