修改示例
This commit is contained in:
parent
c5ffb784a5
commit
0f518853f1
@ -18,6 +18,7 @@
|
||||
<h1>这是背景页</h1>
|
||||
<div>
|
||||
<a href="#" id="test_cors">跨域演示</a>
|
||||
<a href="#" id="get_popup_title">获取popup页标题</a>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
|
||||
|
@ -63,6 +63,15 @@ $('#test_cors').click((e) => {
|
||||
});
|
||||
});
|
||||
|
||||
$('#get_popup_title').click(e => {
|
||||
var views = chrome.extension.getViews({type:'popup'});
|
||||
if(views.length > 0) {
|
||||
alert(views[0].document.title);
|
||||
} else {
|
||||
alert('popup未打开!');
|
||||
}
|
||||
});
|
||||
|
||||
// 获取当前选项卡ID
|
||||
function getCurrentTabId(callback)
|
||||
{
|
||||
|
@ -76,21 +76,21 @@
|
||||
"chrome_url_overrides":
|
||||
{
|
||||
// 覆盖浏览器默认的新标签页
|
||||
"newtab": "newtab.html"
|
||||
},
|
||||
"newtab": "newtab.html"
|
||||
},
|
||||
// Chrome40以前的插件配置页写法
|
||||
"options_page": "options.html",
|
||||
// Chrome40以后的插件配置页写法,如果2个都写,新版Chrome只认后面这一个
|
||||
"options_ui":
|
||||
{
|
||||
"page": "options.html",
|
||||
"page": "options.html",
|
||||
// 添加一些默认的样式,推荐使用
|
||||
"chrome_style": true
|
||||
"chrome_style": true
|
||||
},
|
||||
// 向地址栏注册一个关键字以提供搜索建议,只能设置一个关键字
|
||||
"omnibox": { "keyword" : "go" },
|
||||
// 默认语言
|
||||
"default_locale": "zh_CN",
|
||||
// devtools页面入口,注意只能指向一个HTML文件,不能是JS文件
|
||||
"devtools_page": "devtools.html"
|
||||
"devtools_page": "devtools.html"
|
||||
}
|
Loading…
Reference in New Issue
Block a user