google-chrome-extension

Chrome Extension Socket io node js

不想你离开。 提交于 2020-11-30 06:08:01
问题 I need to create a chrome extension which shows a notification when we get a message from socket io node js server. How to include socket io in chrome extension? I am not able to get this to working. Content.js:- Uncaught ReferenceError: io is not defined var socket = io.connect('http://localhost:1337'); socket.on("hello",function(data){ console.log(data.text); chrome.runtime.sendMessage({msg:"socket",text:data.text},function(response){}); }); Manifest:- This is not importing socket io Failed

How to disable (gray out) page action for Chrome extension?

谁都会走 提交于 2020-11-30 00:21:19
问题 I want the Chrome extension icon to be disabled (grayed out) on all pages except for pages on docs.google.com. This is my code in background.js. 'use strict'; chrome.runtime.onInstalled.addListener(function() { chrome.declarativeContent.onPageChanged.removeRules(undefined, function() { chrome.declarativeContent.onPageChanged.addRules([{ conditions: [new chrome.declarativeContent.PageStateMatcher({ pageUrl: { urlContains: 'docs.google' }, }) ], actions: [new chrome.declarativeContent

How to disable (gray out) page action for Chrome extension?

心已入冬 提交于 2020-11-30 00:17:35
问题 I want the Chrome extension icon to be disabled (grayed out) on all pages except for pages on docs.google.com. This is my code in background.js. 'use strict'; chrome.runtime.onInstalled.addListener(function() { chrome.declarativeContent.onPageChanged.removeRules(undefined, function() { chrome.declarativeContent.onPageChanged.addRules([{ conditions: [new chrome.declarativeContent.PageStateMatcher({ pageUrl: { urlContains: 'docs.google' }, }) ], actions: [new chrome.declarativeContent

Shadow Dom inheriting parent page CSS [Chrome] [duplicate]

半城伤御伤魂 提交于 2020-11-29 04:29:45
问题 This question already has an answer here : Light DOM style leaking into Shadow DOM (1 answer) Closed 6 months ago . Everything I've read indicates that the Shadow Dom is supposed to be 'safe' from its parent page CSS. I.E. if I have all divs styled to have purple font: <style> div{color: purple} </style> The divs in my Shadow Dom should have the browser default color. I am writing a chrome extension that injects html into any given page. Unless this html is protected by either Shadow Dom or