manifest.json
{
"name": "test1",
"description": "test1",
"version": "1.0",
//所需要的权限
"permissions": [
"tabs", "http://*/*", "https://*/*"
],
"browser_action": {
"default_title": "Set this page's color.",
"default_icon": "icon.png",
"default_popup": "popup.html"
},
"manifest_version": 2
}
页面元素点击事件&&js插入母页面
var t1=document.getElementById("t1");
//点击T1元素 运行此事件
t1.οnclick=function ()
{
jszr("alert(1)");
};
//js代码插入母页面运行
function jszr(str1)
{
chrome.tabs.executeScript
({
code:str1
});
}