google-chrome-extension

Chrome Extension: query tabs async

我的未来我决定 提交于 2019-12-23 04:42:02
问题 I have two variables being set to the "return value" of functions, these functions are to get the URL of a tab, and a reference to the actual tab object, and store them in variables. I have some code: function init(){ var url = getUrl(); var tab = getTab(); } function getUrl(){ var tablink; chrome.tabs.query({currentWindow: true, active: true},function(tabs){ tablink = tabs[0].url; return tablink; }); } function getTab(){ var tab; chrome.tabs.query({currentWindow: true, active: true},function

Submitting a Keyword in HTML that goes into Javascript

[亡魂溺海] 提交于 2019-12-23 04:38:41
问题 I am looking to make a Chrome extension.. I want an Options Page where you submit a keyword: <html> <head> <title>Options</title> </head> <body> Keyword:<input id="keyText" name="Keyword" type="text"> <input name="Submit" type="submit" value="Submit"> </body> </html> This javascript is supposed to refresh twitter until it find a keyword then clicks on the link in the tweet. I want this submitted keyword to be put in to a java script into the first var: var shoeName = ""; var nikestore =

Gmail Content Security Policy on Chrome extensions

拥有回忆 提交于 2019-12-23 04:32:23
问题 Gmail just updated its Content Security Policy: http://googleonlinesecurity.blogspot.com/2014/12/reject-unexpected-content-security.html This is throwing an error for my Chrome extension, which augments gmail. To be clear, my content script is loading another script that is hosted on my server. This allows for rapid deployment. Refused to load the script 'https://<domain-path>.js?' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline' 'unsafe

How to get pixel data from canvas which contains the screenshot generated by a chrome extension?

随声附和 提交于 2019-12-23 04:32:20
问题 I am trying to implement a very simple color picker chrome extension. The idea is simple. make use of the captureVisibleTab API provided by chrome to get screenshot of current page at regular intervals. load this screenshot in a canvas and then use get getImageData method for canvas context and display color values of the pixel based on the mouse coordinates. I thought the idea was fairly simple to implement, but it actually did not turn out so well. Any help with the following snippets would

chrome extension: how to insert sidebar via iframe in content?

自古美人都是妖i 提交于 2019-12-23 04:29:24
问题 I want to add a vertical side bar on the left side of the current page by injecting an iframe via chrome extension I'm building. How can I achieve this in a way that it is consistent on any web page, like the sidebar won't end up overlapping the current page and etc. I want to make sure that the page gets pushed to the side to make room for the side bar. I also don't want the content of the sidebar to be affected by the css styling on the current page, so I'm thinking of putting it inside an

chrome in offline mode/open cached site?

不问归期 提交于 2019-12-23 04:28:07
问题 I have a special kiosk-solution with chrome where I need chrome to upon application start, load the start-url from cache, not try to fetch it online. The reason is that this is, like I said, a kiosk-mode presentation, is is a screen standing in the public that reboots every night, and if the reboot happens while the ISP has downtime on the internet connection, chrome will only show an error page. If I can get it to load the cached version of the page though, instead of trying to fetch it

Implementing Google+ one-time code flow authentication from chrome extension

自古美人都是妖i 提交于 2019-12-23 04:08:08
问题 I am trying to implement a Google+ sign in option as part of a chrome extension using the one-time code flow as described here. While making a request using the javascript Google API package a popup opens with an "origin_mismatch" error. This is obviously since I need to add my origin to the relevant Client Id on the Google API console. My origin is : chrome-extension://<my extension id> however when trying to add that on the API console I get an error saying "Invalid URI: chrome-extension://

Block downloading by Content-Type via Chrome Extension

旧时模样 提交于 2019-12-23 03:38:19
问题 I am developing an extension for blocking downloading by file's Content-Type. This is part of background script which handle headers receiving: chrome.webRequest.onHeadersReceived.addListener(function(details) { var headers = details.responseHeaders; for(var i = 0, l = headers.length; i < l; ++i) { if(headers[i].name == "Content-Type" && headers[i].value == "<some_type>") { return {cancel: true}; } } }, {urls: ["<all_urls>"]}, ["responseHeaders", "blocking"]); And I get page with error

Redirecting user using chrome.webRequest depending on server response

纵饮孤独 提交于 2019-12-23 03:35:10
问题 It seems I have found myself in a catch 22. I am using the Chrome Web Request event in an extension to get the URL of all web requests as such: chrome.webRequest.onBeforeRequest.addListener( function(request) { var cat = getCategory(request.url); if(cat == "1") { return {redirectUrl: "http://google.com"} } else { return {cancel: false} } } }); Then, I want to query my server using PHP to get the URL’s category. If it has a category of 1, I want to block it, if it has a category of 0, I want

Chrome content scripts in Dart

不羁的心 提交于 2019-12-23 03:28:10
问题 Is it possible to use dart for chrome extension content scripts? The following does not seem to call anything in main() import 'dart:html'; import 'package:js/js.dart' as js; void main() { js.context.alert('Hello from Dart via JavaScript'); window.console.log("START!!!"); window.alert("alert"); } manifest.json... "content_scripts": [ { "matches": [ "http://docs.google.com/*", "https://docs.google.com/*" ], "js": [ "packages/browser/dart.js", "packages/browser/interop.js", "packages/js/dart