google-chrome-extension

Getting the Final redirected URL from within PowerShell

天涯浪子 提交于 2021-02-05 10:41:43
问题 I'm finding similar answers, but not exactly what I'm needing. The backstory: I'm trying to write a powershell script that will scrape the Chrome and Microsoft Edge (chromium-based) extensions directory and output the name, ID, and version into a custom WMI class so that my endpoint management agent can accurately reflect user-installed extensions within the inventory record. In Chrome, this is reasonably easy even if the manifest.json doesn't include a human-readible "name" property, because

Getting the Final redirected URL from within PowerShell

依然范特西╮ 提交于 2021-02-05 10:41:05
问题 I'm finding similar answers, but not exactly what I'm needing. The backstory: I'm trying to write a powershell script that will scrape the Chrome and Microsoft Edge (chromium-based) extensions directory and output the name, ID, and version into a custom WMI class so that my endpoint management agent can accurately reflect user-installed extensions within the inventory record. In Chrome, this is reasonably easy even if the manifest.json doesn't include a human-readible "name" property, because

Chrome extension simple script not being injected

纵然是瞬间 提交于 2021-02-05 09:27:47
问题 I'm trying my first steps in writing a minimal Chrome extension, and I cannot figure out why it does not execute my clientScript.js. This is my manifest.json: { "name": "Sit back, relax and enjoy", "version": "0.1", "description": "Finds and clicks the +extra channel points button when it is available", "permissions": [ "activeTab" ], "content_scripts": [ { "matches": [ "https://twitch.tv/*" ], "js": [ "contentScript.js" ], "run_at": "document_idle" } ], "manifest_version": 2 } And this is

js querySelectorAll not a valid selector despite it being like the docs example [duplicate]

天涯浪子 提交于 2021-02-05 09:15:06
问题 This question already has answers here : Error while query selector on numeric value (2 answers) Closed 2 years ago . https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll Here, an attribute selector is used to return a list of the list items contained within a list whose ID is "userlist" which have a "data-active" attribute whose value is "1" var container = document.querySelector("#userlist"); var matches = container.querySelectorAll("li[data-active=1]"); but when i try

Create new window and insert dynamic content in Chrome Extension

偶尔善良 提交于 2021-02-05 08:26:47
问题 I'm having trouble creating a new window and adding content from my extension. Since I can't call window.open from my script without losing a reference to my new window, I'm forced to use chrome.windows.create. Essentially what I want is this: var newWindow = window.open(); newWindow.document.writeln( 'hello world' ); To create the equivalent in my chrome extension, i'm trying this: chrome.windows.create({ type: 'popup' } , function(newWindow) { newWindow.tabs[0].executeScript(null, { code:

Save program state in chrome extension between uses

久未见 提交于 2021-02-05 07:45:28
问题 I have a chrome extension that does spell check. I want to implement the feature to 'add a word to dictionary' but I read that chrome extension api does not allow reading and writing to disk. currently my dictionary is an array of strings: var dictionary = ["google", "apache", "microsoft"]; My question is this: How should I properly store my dictionary? And how can I change its content during run time for the 'add to dictionary feature'? 回答1: As Josh mentioned, use the chrome storage API. For

Adding keyboard shortcuts to execute Chrome extension

℡╲_俬逩灬. 提交于 2021-02-05 06:48:46
问题 I have created a chrome extension which I'd like to cause execution using a keyboard shortcut. Snippet: "suggested_key": { "default": "Ctrl+Shift+F" I've tried different combinations such as "Ctrl+Shift+A", "Ctrl+Shift+D", "Alt+X" and "Space+B" None of these seems to work. Am I spelling out Alt or Space wrong? 回答1: The suggested key from your manifest file works only if there is no other action bound to the same keyboard shortcut. From documentation: The user is free to designate any shortcut

Chrome Extension:How to show background image in new Tab

无人久伴 提交于 2021-02-04 19:28:09
问题 I am willing to have a similar functionality like given in popular extensions like Moments or Limitless which show beautiful wallpaper. How can I implement it? Also, if multiple similar extensions are installed who shows image on new tab, is there way to let chrome show my image in tab first? Thanks 回答1: This is possible by indicating a different new tab page in the chrome_url_overrides property in the manifest.json : { "name": "My extension", "chrome_url_overrides" : { "newtab":

Multiple background scripts in a Google Chrome extension?

为君一笑 提交于 2021-02-04 15:53:45
问题 I've been tasked with creating a Google Chrome extension. So far, everything works fine. However, I would like to be able to use multiple background scripts (what I mean is "background" : {"scripts" : ["background.js"]}, if what I'm talking about is unclear) rather than creating multiple extensions. Is this possible? Regards, 回答1: According to the documentation: A background page will be generated by the extension system that includes each of the files listed in the scripts property. So yes,

How to read and display file in a chrome extension

六月ゝ 毕业季﹏ 提交于 2021-02-04 14:56:10
问题 I want to read and display the contents of file in a chrome extension (The file is already inside the extension directory).How do it?Whether I can use HTML5 to read it? var elema3 = document.body.getElementsByClassName("slicefooter"); elema3[0].innerHTML='Shanmuga Subramanian'; var a1=chrome.extension.getURL('script1.txt'); var reader = new FileReader(); reader.readAsText(a1); 回答1: Use XMLHttpRequest. Example: var xhr = new XMLHttpRequest(); xhr.open('GET', chrome.extension.getURL('script1