Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/google-chrome/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google chrome chrome扩展中的chrome弹出窗口_Google Chrome_Google Chrome Extension - Fatal编程技术网

Google chrome chrome扩展中的chrome弹出窗口

Google chrome chrome扩展中的chrome弹出窗口,google-chrome,google-chrome-extension,Google Chrome,Google Chrome Extension,我正在开发chrome扩展,我想构建一个扩展,从浏览器的url地址栏中捕获url以及该url的协议。 如果访问url协议不是https,则扩展必须显示包含一些消息的弹出窗口。我有一个下面的代码,这是工作正常,但问题是,它显示一个弹出消息后,点击扩展图标,所以我想要的弹出窗口应该是自动显示当用户访问一些非https协议的url。代码如下 manifest.json { "name": "A browser action with a popup that changes the page co

我正在开发chrome扩展,我想构建一个扩展,从浏览器的url地址栏中捕获url以及该url的协议。 如果访问url协议不是https,则扩展必须显示包含一些消息的弹出窗口。我有一个下面的代码,这是工作正常,但问题是,它显示一个弹出消息后,点击扩展图标,所以我想要的弹出窗口应该是自动显示当用户访问一些非https协议的url。代码如下

manifest.json

{
  "name": "A browser action with a popup that changes the page color",
  "description": "Change the current page color",
  "version": "1.0",
  "permissions": [
  "tabs", "http://*/*", "https://*/*","notifications","webNavigation", "*://*/*"
],
"browser_action": {
  "default_title": "Set this page's color.",
  "default_icon": "icon.png",
  "default_popup": "popup.html"
},

"manifest_version": 2
}
popup.js

document.addEventListener('DOMContentLoaded', function () {

chrome.tabs.query({currentWindow: true, active: true}, function(tabs){

    createNotification();

});

});

function createNotification(){
var opt = {type: "basic",title: "Your Title",message: "Your   message",iconUrl: "icon.png"}
chrome.notifications.create("notificationName",opt,function(){});
}

实际上,我不想显示工具栏弹出窗口,我只想通知弹出窗口,然后在后台页面脚本中移动代码,另请参见:。