google-chrome-extension

Chrome Extension that copies image URL on click

我怕爱的太早我们不能终老 提交于 2019-12-14 02:19:24
问题 I'm brand new to making Chrome Extensions and have done the simple tutorials, but I'm having trouble finding what I need. I want the extension to allow a user to chose an image on a webpage, and then copy the URL for that image into the extension. Can anyone help me out? I'm sure if I see an example I'd get a better grasp on how extensions can interact with a page. 回答1: From what I understand of your question, I'd say you want to create a context menu item that shows up when you right-click

Not working loaded jquery file in the content_script in chrome extension

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-14 02:03:48
问题 I am new to this chrome extension plugin development. I am developing a new new plugin using this chrome extension. My requirement is load jquery.js file into the content script when it is not having that js file(For Ex: I am checking for jquery.js file,fancybox.js file and if it is not there load these files. ) When i implement this logic in content script it is loading the jquery.js file. After that it is not working in content script . It is showing $(or) jQuery is undefined. For every

How to prevent/detect race condition between processing and restoring store data when waking up an Event page

牧云@^-^@ 提交于 2019-12-14 01:15:12
问题 I am using sendMessage and onMessage listener (both in background and content pages), and I am seeing some messages are getting lost. I have a few "global" variables that I store everytime I go to suspend state, and restore them among the first things when the script starts (I register the handlers first). However, given that the chrome.storage is asynchronous, I suspect message processing is happening before I get to load the global state (and hence the appearance of losing the messages).

Chrome.system.cpu API Usage

笑着哭i 提交于 2019-12-14 00:36:47
问题 Is it possible to use the chrome.system.cpu api to get the current CPU load? I specifically can't figure out how to convert the returned numbers to a percent of the total current load. I found this, but not quite sure how to implement: "Callers can compute load fractions by making two calls, subtracting the times, and dividing by the difference in totalTime." https://developer.chrome.com/apps/system_cpu Answer : An example of getting CPU usage is here: https://github.com/beaufortfrancois/cog

How to change Chromium configs through extension

二次信任 提交于 2019-12-13 23:38:55
问题 I need some advice about Chromium extension possibilities. Can the extension change configs of the browser such as: home page, default behavior for protocol handlers (tel, mailto), security settings ("protect from dangerous websites" for example), disable sending statistics to Google, etc.? Which configs from chrome://settings/ can be changed and how to do it if it's possible? 回答1: The Chrome API index is a good place to start. From it, you can glean the following capabilities:

How may I get the element attributes (text, id, class and so on..) of the current tab, out of a mouse click, from a chrome extension?

▼魔方 西西 提交于 2019-12-13 23:14:23
问题 I'm pretty new on chrome extensions and so far, I could manage to get the current tab title and mouse positions, however, I've made some searches and couldn't find a way to get the element attributes, such as "e.target.innerText" when I click on them, right click and get a new option, anything from a mouse input, does anyone knows how to do so? This is what my popup.js looks like window.onclick = e => { chrome.extension.getBackgroundPage().chrome.tabs.executeScript(null, { code:'chrome

Using Plugins in Chrome Extension

一笑奈何 提交于 2019-12-13 21:42:28
问题 I am making a Chrome extension and want to implement a plugin mark.js (https://markjs.io/) that would highlight text on the user page. However, I am having trouble importing the plugin. Since the html is the user's page and I don't have access to it, I can't use the usual <script></script> . So, I tried to use JavaScript to do it, but am still getting an error. My JavaScript code is as follows: var head= document.getElementsByTagName('head')[0]; var script= document.createElement('script');

load chrome extension popup faster

╄→尐↘猪︶ㄣ 提交于 2019-12-13 20:34:12
问题 My chrome extension is very simple. After the popup is clicked an iframe is loaded. The chrome extension is slightly slow. I click the icon and it takes about a second and a half to load, and I feel like that is too slow. I'd like the popup to show instantly but have the iframe load after.. or perhaps there is an even quicker way... The site that I am iframing only has a textbox visible so in theory the popup should load pretty quickly but I'm just not getting it. My manifest file basically

Chrome Console/Extensions: Visit a URL and click a button. Rinse and repeat for a different URL

怎甘沉沦 提交于 2019-12-13 20:18:10
问题 INITIAL QUESTION: Is it possible to run javascript from Chrome's Console that will: Navigate to a given URL Click a button I'd like to repeat the above steps for hundreds of URLs. I'm sure if I get the two steps working iterating over a number of URLs will be fairly straightforward. So, I've made Console persistent between page refreshes, so that's a good start...but it seems the Click event it not being triggered. The clicking command works fine if I manually navigate to the URL then run it

Chrome Extension Page Action not showing next to omnibar

随声附和 提交于 2019-12-13 20:08:43
问题 Manifest: { "manifest_version":2, "name":"Optimize url", "description":"Optimize url", "page_action":{ "default_icon":{ "19":"url-icon16.png", "38":"url-icon48.png" }, "default_title":"Optimize url" }, "background":{ "scripts":["background.js"] }, "version":"0.1", "permissions":[ "tabs", "https://url.com/*" ] } Background JS: function checkURL(){ var host = parseURL(tab.url).host; if (host.indexOf("url.com") >= 0) { chrome.pageAction.show(tabId); } } chrome.tabs.onUpdated.addListener(checkURL