google-chrome-extension

Accessing file data after download in Chrome…?

独自空忆成欢 提交于 2019-12-18 03:45:28
问题 I'm writing an extension that would ideally read files after they are downloaded (through the normal download process). Is that possible? I can get the filename through chrome.downloads operations, but I can't find ways of reading the actual bytes. I don't need to write or move them, just read. 回答1: I struggled with the exact same problem and finally found an easy workaround to read the content of downloaded files from a Chrome extension. You just need to add a permission to file://* in your

How to use Service Workers in Google Chrome extensions to modify an HTTP response body?

坚强是说给别人听的谎言 提交于 2019-12-18 03:44:14
问题 Now that Google Chrome extensions can register Service Workers, how can I use them in order to modify HTTP responses from all hosts, e.g. by replacing all occurrences of cat with dog ? Below is a sample code from Craig Russell, but how to use it inside Chrome extensions and bind it to all hosts? self.addEventListener('fetch', function(event) { event.respondWith( fetch(event.request).then(function(response) { var init = { status: response.status, statusText: response.statusText, headers: {'X

Get page selection including HTML?

流过昼夜 提交于 2019-12-18 03:43:59
问题 I'm writing a Chrome Extension, and I was wondering if it was possible to get the selected text of a particular tab, including the underlying HTML? So if I select a link, it should also return the <a> tag. I tried looking at the context menu event objects (yes, I'm using a context menu for this), and this is all that comes with the callback: editable : false menuItemId : 1 pageUrl : <the URL> selectionText : <the selected text in plaintext formatting, not HTML> It also returns a Tab object,

Chrome Extension: fire an event when element created?

两盒软妹~` 提交于 2019-12-18 03:39:09
问题 I'd like to fire an event when an element is added to the document. I've read the JQuery documentation for on() and the list of events but none of the events seem to concern element creation. I must monitor the DOM as I do not control when the element is added to the document (as my Javascript is a Chrome Extension content script) 回答1: I know this is an old question, that already has an answer, but since things have changed, I thought I'd add an updated answer for people landing on this page

chrome.app.isInstalled always returns false for Google Chrome extensions?

∥☆過路亽.° 提交于 2019-12-18 03:20:27
问题 why does chrome.app.isInstalled always return false for Google Chrome extensions? Dynamically I add a link element on page load: <link type="text/css" rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/itemID"> The following is some Javascript that executes when a button has been clicked: if (!chrome.app.isInstalled) { alert('extension is about to be installed!'); install_extension(); }else{ alert('extension is installed already.'); } The first time I clicked the

chrome.app.isInstalled always returns false for Google Chrome extensions?

房东的猫 提交于 2019-12-18 03:20:05
问题 why does chrome.app.isInstalled always return false for Google Chrome extensions? Dynamically I add a link element on page load: <link type="text/css" rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/itemID"> The following is some Javascript that executes when a button has been clicked: if (!chrome.app.isInstalled) { alert('extension is about to be installed!'); install_extension(); }else{ alert('extension is installed already.'); } The first time I clicked the

Chrome identity launchWebAuthFlow only opens empty callback page

偶尔善良 提交于 2019-12-18 03:17:14
问题 Sorry for yet another probably noob question, normally I don't give in until I find a solution myself but this one has me going for 3 days and it is time to admit I'm stuck... I'm trying to authenicate a Chrome extension to use PushBullet user data via OAuth2: background.js var client_id = '<32 DIGIT CLIENT ID>'; var redirectUri = "chrome-extension://lgekckejcpodobwpelekldnhcbenimbe/oauth2"; var auth_url = "https://www.pushbullet.com/authorize?client_id=" + client_id + "&redirect_uri=" +

In Google Chrome, what is the extension api for changing the UserAgent and Device Metrics?

落花浮王杯 提交于 2019-12-18 02:50:49
问题 In Google Chrome, when viewing the developer tools, in the bottom right there is a Gear Icon that opens an additional Settings popup. One of the pages in the Settings popup is Overrides that contains User Agent and Device Metrics settings. I am trying to find the extensions API that is able to set those values programatically. Does such an API exist? I've looked the main apis, and the experimental apis , but can't seem to find anything. The sample for devtools.panels in the code samples doesn

Two way communication is returning error in Chrome Extension [duplicate]

大兔子大兔子 提交于 2019-12-18 02:46:20
问题 This question already has answers here : Chrome Extension Message passing: response not sent (3 answers) Closed 3 years ago . I am trying to send messages between contentscript and background script like below ContentScript.js chrome.extension.sendMessage({ type : "some" }, function(response) { anotherFunction( response.data ); return true; }); function anotherFunction(data){ // Some code here chrome.extension.sendMessage({ type : "someOther" }, function(response) { console.log( response.data

Chrome extension that runs code when ajax requests happen

丶灬走出姿态 提交于 2019-12-18 02:43:16
问题 So, to give a basic description of my issue. I have a extension that is working right now (finally) that wraps phonenumbers in an type of tag. It is working right now, but I am having an issue with anything that is dynamically loaded via JS based on user action, or based on ajax requests For example, if I click a hotmail email, and open it, the script works, but only when I refresh the page so that the email loads and calls my contentscript. I thought about getting around this by making the