javascript - In background script, chrome.runtime is undefined -


i'm not able access events inside background script. (i have disabled other extension, chrome version: version 59.0.3071.115 (official build) (64-bit)

download extension zip file, doesn't work same issue. https://drive.google.com/file/d/0b2pmiyi-mparcmlwvtl0uufjnta/view?usp=sharing

manifest:

"background": {     "page": "client_base/host/chrome/index.html",     "persistent": true   },   "content_scripts": [     {       "matches": [         "*://mail.google.com/*"       ],       "css": [         "/gmail_ext/content_script.css"       ],       "js": [         "/gmail_ext/loader.js"       ],       "run_at": "document_end"     }   ], 

content script:

var getcontactsport = chrome.runtime.connect('getcontacts');     getcontactsport.postmessage({greeting: "hello"});     getcontactsport.onmessage.addlistener(function (message, sender) {         alert(message);     }); 

background script (which called page script tag, via dojo)

chrome.runtime.onconnect.addlistener(function (getcontactsport) {                 getcontactsport.onmessage.addlistener(function (msg) {                     console.log(msg);                     getcontactsport.postmessage({status: msg.greeting + ' world'});                 });             }); 

devtools showing chrome.runtime undefined:

devtools showing <code>chrome.runtime</code> undefined:


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -