google-chrome-extension

Mark js, Anchor tag issue

为君一笑 提交于 2020-06-17 15:48:10
问题 I've been using a chrome extension to select sentences on the page. I were recommended to used the library Mark.js to avoid destroying event listener and or element inside elements. var markInstance = new Mark(document.body); var options = { element: `mark`, className: `highlight-${position}`, exclude: ['.ignore'], separateWordSearch: false, debug: true, }; markInstance.mark(sentence, options); I've been having problems with sentences that contains hyperlinks Examples: Learn more about the

Background.js to content.js using Port & Long-lived messaging

≡放荡痞女 提交于 2020-06-17 11:01:45
问题 I've accomplished sending a single message from background.js to content.js using chrome.runtime.onMessage.addListener but I need to send a lot of messages throughout the extensions lifecycle, therefore I need to open a port and use long-lived messaging . However, I can't find any working examples of opening a port and sending messages/objects between a background.js file and a content.js file. Does anyone have a decent example that works? I've also run into issues with the following when

Background.js to content.js using Port & Long-lived messaging

杀马特。学长 韩版系。学妹 提交于 2020-06-17 10:59:28
问题 I've accomplished sending a single message from background.js to content.js using chrome.runtime.onMessage.addListener but I need to send a lot of messages throughout the extensions lifecycle, therefore I need to open a port and use long-lived messaging . However, I can't find any working examples of opening a port and sending messages/objects between a background.js file and a content.js file. Does anyone have a decent example that works? I've also run into issues with the following when

How to handle different messages (from content script) in different functions of background script?

大兔子大兔子 提交于 2020-06-17 09:15:33
问题 The content script of my chrome extension has two event listener functions. The two functions sends different variable as message. So if the background script wants to distinguish between these events / variables how do I do this? Can I have multiple functions in background scripts to listen to particular type of events only? If yes, how can I achieve this. Currently I am sending an id 1 and 2 (along with the message to background script) from each of the function and using if-else to

How to move existing items (Chrome extension) from my personal account to a Group Publisher account?

為{幸葍}努か 提交于 2020-06-17 09:05:33
问题 I have an extension in my personal account, and I already created a Group Publisher account, and now I want to move the extension from my personal account to the Group publisher account I've created. I already read this document: https://developer.chrome.com/webstore/publish#move-existing-items-to-a-group-publisher-account I was able to create and setup the Group publisher, but the problem now is that I can't see the Transfer existing item(s) option (that's supposed to be next to Add New Item

Run my Javascript code on every page on my browser, similar to how a chrome extension would

匆匆过客 提交于 2020-06-16 06:47:47
问题 I know with Chrome I can use snippets to manually run some js code on a webpage. But This required manually executing the snippet. is there any way to have some JS code that my browser (chrome or firefox) would every time I visited a new page? 回答1: You may be looking for userscripts. These allow you to write Javascript code which will then be automatically executed whenever you visit a page matching a particular pattern. For example, the following userscript: // ==UserScript== // @name

How do you derive walltime from timestamp using Chrome's debugger protocol?

不打扰是莪最后的温柔 提交于 2020-06-16 04:26:25
问题 I've been building a Chrome extension using in part the Chrome debugger protocol. Certain events in the Network domain like requestWillBeSent include a "timestamp" as well as a "wallTime." The walltime is a regular seconds since 1970 format, but the timestamp is in seconds but its not clear where its 0 is, and many events have no wallTime so I'm really trying to figure out how to derive wallTime from timeStamp. Based on this I believed to be based on the navigationStart value but that did not

How to use Chrome Extension Api with Angular?

橙三吉。 提交于 2020-06-15 20:10:58
问题 I am working on a chrome extension, I have a " background.js " which it filters the url and fetchs data from my api. When the conditions is meet I am sending a message from " background.js ". And I want to catch it from Angular component . background.js ... chrome.pageAction.show(tab.id, () => { chrome.runtime.sendMessage({data: dataFromAPI}) }); ... I ran npm install --save @types/chrome . app.component.ts import {Component} from '@angular/core'; import {chrome} from '@types/chrome';

How to use Chrome Extension Api with Angular?

|▌冷眼眸甩不掉的悲伤 提交于 2020-06-15 20:04:49
问题 I am working on a chrome extension, I have a " background.js " which it filters the url and fetchs data from my api. When the conditions is meet I am sending a message from " background.js ". And I want to catch it from Angular component . background.js ... chrome.pageAction.show(tab.id, () => { chrome.runtime.sendMessage({data: dataFromAPI}) }); ... I ran npm install --save @types/chrome . app.component.ts import {Component} from '@angular/core'; import {chrome} from '@types/chrome';

chrome.tabs.getCurrent() or tabs.query()

最后都变了- 提交于 2020-06-12 02:47:24
问题 Both methods are producing the same error Uncaught TypeError: Cannot read property 'query' of undefined for my content script... I've already looked at How to fetch URL of current Tab in my chrome extension using javascript and How do you use chrome.tabs.getCurrent to get the page object in a Chrome extension? though I'm still not sure what I'm doing incorrectly. manifest.json { "name": "Extension Tester", "version": "0.0.1", "manifest_version": 2, "description": "Tester", "permissions": [