From 0f518853f1a1f2e0632b42baa3fb8b2138b2220d Mon Sep 17 00:00:00 2001
From: liuxianan <937925941@qq.com>
Date: Mon, 26 Jun 2017 02:13:17 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A4=BA=E4=BE=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
demo/background.html | 1 +
demo/js/background.js | 9 +++++++++
demo/manifest.json | 10 +++++-----
3 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/demo/background.html b/demo/background.html
index 22d2923..e281c0f 100644
--- a/demo/background.html
+++ b/demo/background.html
@@ -18,6 +18,7 @@
这是背景页
diff --git a/demo/js/background.js b/demo/js/background.js
index 1b12f90..6adc758 100644
--- a/demo/js/background.js
+++ b/demo/js/background.js
@@ -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)
{
diff --git a/demo/manifest.json b/demo/manifest.json
index a0534b6..4a9010a 100644
--- a/demo/manifest.json
+++ b/demo/manifest.json
@@ -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"
}
\ No newline at end of file