google-chrome-extension

Chrome extension: create tab then inject content script into it

最后都变了- 提交于 2019-12-18 04:55:22
问题 Upon receiving a message from a content script I want to create a new tab and fill the page it opens dynamically (for now I'm just trying to turn the newly created page red). eventPage.js: // ... code that injects another content script, works fine // Problem code... chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { chrome.tabs.create({url: chrome.extension.getURL("blankpage.html")}, turnTabRed); }); function turnTabRed(tab) { chrome.tabs.executeScript( tab.id,

How to wait for an asynchronous method's callback return value?

烈酒焚心 提交于 2019-12-18 04:50:12
问题 I know that waiting for an asynchronous method is stupid, one should use callbacks instead. But what if an third party API forces you to be synchronous? I'm developing a Chrome Extension that will prevent the user from visiting websites that's already open in another tab. I basically need to cancel requests based on the urls in open tabs. I want to use chrome.webRequest.onBeforeRequest like this: function onBeforeRequest(details) { var websiteAlreadyOpenInOtherTab; // Here i want to set

How to cancel webRequest silently in chrome extension

与世无争的帅哥 提交于 2019-12-18 04:48:14
问题 I'm re-posting my question from Chromium-extensions google group here. In my extension, I want to cancel some webRequests based on url pattern. My problem is that, if I return {cancel:true} in the onBeforeRequest event listener, the browser would redirect to a page telling me that the request is blocked by some extension. But I just want to cancel the request silently(as nothing happened). I have also tried to return {redirectUrl:""} in the onBeforeRequest event listener, the console would

How to load a content script on all Google (international) pages?

北战南征 提交于 2019-12-18 04:47:07
问题 For a Google-Chrome extension, I would like to load a content script on all Google pages. What is the best way to do this? I tried this, in the manifest.json , but it does not work: "matches": ["http://www.google.*/*", "https://www.google.*/*"], This "works" but it is a bit long to write and I do not think it is the best practice: "matches": ["http://www.google.com/*", "https://www.google.com/*", "http://www.google.fr/*", "https://www.google.fr/*", "http://www.google.de/*", "https://www

Use 'Chrome Native Messaging' from Sublime Text plugin

柔情痞子 提交于 2019-12-18 04:23:17
问题 With 'Native Messaging' it should be possible to communicate between a chrome extension and a native app. https://developer.chrome.com/extensions/nativeMessaging Google even provides an example for how to do this with a python "host"-app: https://chromium.googlesource.com/chromium/src/+/master/chrome/common/extensions/docs/examples/api/nativeMessaging/host/native-messaging-example-host I wanted to use this technique to communicate between a Sublime Text plugin (python) and an Chrome extension

Several problems with icons during Chrome Extension development

隐身守侯 提交于 2019-12-18 04:21:58
问题 It's very strange. 1 problem If I add this icon declaration to my manifest: "icons": { "16": "images/icon16.png", "48": "images/icon48.png", "128": "images/icon128.png" }, Then, when I add Extension through "Load unpacked extensions ... " it doesn't show logo But if you try to delete it, it does show AND! If I delete "48" line from manifect, it starts showing it right away. Maybe it's because I use Chrome Beta (Version 28.0.1500.20 beta) or maybe because I do something wrong. Seconds problem

google chrome extension canvas icon

我们两清 提交于 2019-12-18 04:20:54
问题 I am trying to set the extension icon to a canvas image. I can't seem to get it to set. I just want to get the basics working and expand from there. I can set the icon with an image in the file structure but I want to be able to dynamically update the text later. I tried a few ways to get chrome.browserAction.setIcon to set to no avail. I hope it is not something simple I am missing. Thanks //chrome.browserAction.setIcon({imageData: draw()}); draw(); function draw() { var canvas = document

Is it possible to create dynamic theme in Chrome?

大城市里の小女人 提交于 2019-12-18 04:16:27
问题 I can create static theme as described in documentation which I guess can not be modified at runtime. I need some way or API for changing theme properties at runtime. Is it possible to do it with Chrome? 回答1: No, it's not possible right now. Sorry 来源: https://stackoverflow.com/questions/12420652/is-it-possible-to-create-dynamic-theme-in-chrome

How to steal focus from the omnibox in a Chrome extension on the new tab page?

狂风中的少年 提交于 2019-12-18 04:14:10
问题 I'm making a Chrome extension that involves putting a text input on the new tab page, and immediately giving focus to that input text when the new tab page loads. After being unable to get focus using traditional methods (e.g. focus() ), I stumbled upon this question: Chrome 27: New Tab Page extension can't steal focus from Omnibox which states that Chrome has now made it so that you can't steal omnibox focus on a new tab page. Given that Chrome is fine with giving focus to any site that isn

Triggering a click event from content script - chrome extension

三世轮回 提交于 2019-12-18 04:09:40
问题 In my chrome extension's content script, I click on certain links/buttons on webpages from certain sites. To do that, I use following code in the content script (I embed jQuery in the content script): $(css_selector).trigger("click") This works on most sites. However, on certain sites like delta.com, match.com, and paypal.com, this way of triggering a click on elements does not work. On delta.com, I get following exception thrown when I attempt triggering in the content script: Error: An