google-chrome-extension

chrome extension script is loading twice even more on some pages

陌路散爱 提交于 2020-01-01 04:40:09
问题 this is my background.js file chrome.tabs.onUpdated.addListener(function(tabId,info, tab) { var sites =new Array('site2','site1'); var url=tab.url; var siteFlag=0; for(var i in sites) { var regexp = new RegExp('.*' + sites[i] + '.*','i'); if (regexp.test(url)) {siteFlag=1;} }; if(siteFlag==1){ chrome.tabs.executeScript(tabId, {file:"contentscript.js"}); chrome.tabs.executeScript(tabId, {file:"jquery.js"}); chrome.tabs.insertCSS(tabId,{file:"box.css"}); } }); In the contentscript.js I simply

Use x-webkit-speech in an HTML/JavaScript extension

牧云@^-^@ 提交于 2020-01-01 04:26:10
问题 I am trying to use the new x-webkit-speech function in a simple HTML/JavaScript extension in Google Chrome. I, however, have tried and tried looking at a bunch of examples and cannot get it to successfully call the function. I have seen other people do it, and I don't really get why I cannot. I put the JavaScript code into a separate file, but I include using <script src="filename.js"> this is my line for the x-webkit-speech.... <input id="speechInput" type="text" style="font-size:25px;" x

Why document.execCommand('paste') is not working in my extension

旧街凉风 提交于 2020-01-01 03:37:28
问题 I am creating a Google chrome extension which can read the contents of clipboard. But I am unable to get the documentation for this. I want to get the clipboard content as in IE's clipboard API. In the manifest file i gave permissions to clipboardRead and clipboardWrite. I have created a function in Background page as below chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { if (request.method == "getClipData") sendResponse({data: document.execCommand('paste')});

Chrome Extension's Icon on click

会有一股神秘感。 提交于 2020-01-01 03:04:06
问题 I'm having a difficult time understanding how to have some JS to run when the chrome extension icon has been clicked. I'd like to for example, read some properties from the document, when the icon has been clicked. "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" }, "permissions": [ "activeTab", "clipboardWrite" ] And inside the popup.html, I have the following: chrome.browserAction.onClicked.addListener(function(tab) { alert('working?'); }); But, this doesn't

Chrome Extension's Icon on click

為{幸葍}努か 提交于 2020-01-01 03:03:20
问题 I'm having a difficult time understanding how to have some JS to run when the chrome extension icon has been clicked. I'd like to for example, read some properties from the document, when the icon has been clicked. "browser_action": { "default_icon": "icon.png", "default_popup": "popup.html" }, "permissions": [ "activeTab", "clipboardWrite" ] And inside the popup.html, I have the following: chrome.browserAction.onClicked.addListener(function(tab) { alert('working?'); }); But, this doesn't

How can I get different badge value for every tab on chrome?

痞子三分冷 提交于 2020-01-01 00:57:13
问题 I'm trying to do something like adblock does. Adblock counts number of "ads" and update badge value. For now, I tried to do something with 'background pages', but they are run only one time and badge value is the same for all tabs. I can't use browser action popup.html, because it triggers only after the click. So I need something which takes current tab, is able to read current DOM of tab and after all update badge value . But also after I click on different tab I need to compute new badge

Open chrome extension in a new tab

妖精的绣舞 提交于 2019-12-31 22:41:22
问题 I have implemented a chrome extension. Was wondering if the popup.html can be opened in a new tab? Every single click on the page, and the popup disappears :( .. Was wondering if I can stick it to the page or is there a way to open the extension in a new page? 回答1: Yes, a popup page is just a normal extension page, you can do the following to open a new popup tab from the background page. I use that every time when the user first installs the extension, I open the about page, you can do the

Open chrome extension in a new tab

谁都会走 提交于 2019-12-31 22:41:09
问题 I have implemented a chrome extension. Was wondering if the popup.html can be opened in a new tab? Every single click on the page, and the popup disappears :( .. Was wondering if I can stick it to the page or is there a way to open the extension in a new page? 回答1: Yes, a popup page is just a normal extension page, you can do the following to open a new popup tab from the background page. I use that every time when the user first installs the extension, I open the about page, you can do the

Chrome Extension: DOM traversal

陌路散爱 提交于 2019-12-31 17:25:28
问题 I want to write a Chrome extension that looks at the HTML of the page its on, and if it finds eg <div id="hello"> then it will output, as a HTML list in the popup, 'This page has a friendly div' and if it finds eg <a href="http://bananas.com">I am married to a banana</a> then it will output 'This guy is weird.' So in other words, searching for specific stuff in the DOM and outputting messages in the popup depending on what it finds. I had a look at Google Chrome Extension - Accessing The DOM

How to disable Google Chrome extension autoupdate

你说的曾经没有我的故事 提交于 2019-12-31 07:59:47
问题 How do I disable Google Chrome extension autoupdate? 回答1: Solutions I found for this: 1. Disabling concrete extension update. That's what I wanted! You can do this by editing the extensions manifest json-file on Windows: C:\Users\<USERNAME>\AppData\Local\Google\Chrome\User Data\Default\Extensions\<EXTENSION-ID>\<VERSION>\manifest.json (find out the extensions ID by enabling developer mode in the extension settings page) on Ubuntu for Chromium: ${HOME}/.config/chromium/Default/Preferences In