google-chrome-extension

Chrome extension and local storage

半城伤御伤魂 提交于 2019-12-21 06:09:16
问题 I'm trying to make a Chrome extension. For that extension, I need some info that is dynamically created, but I want that data to be added even later on (on a different page). This is some sort of data that i want to be always accessible (when the plugin runs): var villages = new Array(); villages[0][0] = "village1"; villages[0][1] = "1325848"; villages[1][0] = "village2"; villages[1][1] = "8744351"; villages[2][0] = "village3"; villages[2][1] = "8952187"; As you can see, the array is multi

SSL Client Authentication with Certificate in Chrome App

我们两清 提交于 2019-12-21 05:48:10
问题 I'm writing a Chrome app that needs to have an SSL socket with client authentication. I have done this before in Java with the same set of trust store and key store. Here is what I have done on Chrome (Mac and Chromebook): Add client key (p12) and CA (one root CA, one intermediate CA) to system. In Chrome app, try both the legacy socket API and the new sockets.tcp API. Always receiving error ERR_SSL_CLIENT_AUTH_CERT_NEEDED . But I think I already have the correct client cert and CA in the

Range object with JSON

青春壹個敷衍的年華 提交于 2019-12-21 05:37:09
问题 I am writing a Chrome extension and I need to pass in the value that the user has selected on the website to my server. I am using the code window.getSelection() which returns a range object. I am using JSON to pass the range object back to my server but it is not working. I am new to this, but I think the problem lies with the fact that you can only pass in text with JSON, and the range object includes both the DOM structure (which is not text) and the actual text selection (which is text).

How to catch Chrome error net::ERR_FILE_NOT_FOUND in XMLHttpRequest?

故事扮演 提交于 2019-12-21 05:27:15
问题 I want to create chrome extension which will be able to read local files and use code wrote in them. My simplyfied code is: const readFile = (filePath) => { return new Promise(function (resolve, reject) { const xhr = new XMLHttpRequest() xhr.onerror = (error) => { reject(error) } xhr.onreadystatechange = function () { if (xhr.readyState === 4) { resolve(xhr.response) } } xhr.ontimeout = function () { reject('timeout') } xhr.open('GET', filePath) xhr.send() }) } async function () { const code

chrome.storage.sync.remove array doesn't work

梦想的初衷 提交于 2019-12-21 05:24:05
问题 I am making a small Chrome extension. I would like to use chrome.storage but I can't get it to delete multiple items (array) from storage. Single item removal works. function clearNotes(symbol) { var toRemove = "{"; chrome.storage.sync.get(function(Items) { $.each(Items, function(index, value) { toRemove += "'" + index + "',"; }); if (toRemove.charAt(toRemove.length - 1) == ",") { toRemove = toRemove.slice(0,- 1); } toRemove = "}"; alert(toRemove); }); chrome.storage.sync.remove(toRemove,

Is there any reliable way to capture file upload event in a chrome extension?

喜你入骨 提交于 2019-12-21 05:17:07
问题 In my content script, I want to monitor which file a is getting uploaded to a web application. I monitor "change" event for any "input:file" element. It works on any site (such as Gmail) that uses "input:file". However sites like imgur, use SWFUpload mechanism. I tried to capture "fileQueued" event on element that I suspected to be swfupload. But that did not work. How can I capture file upload event for sites that use swfupload? Are there any other plugins that manage file uploading that I

getCurrentTime() for YouTube Video

风格不统一 提交于 2019-12-21 05:07:23
问题 I'm writing a Chrome Extension in Javascript and I want to get the current time for the playing video on youtube.com. I tried using the answer from question Getting Current YouTube Video Time , e.g.: ytplayer = document.getElementById("movie_player"); ytplayer.getCurrentTime(); However I do get following error: "Uncaught TypeError: Cannot read property 'getCurrentTime' of null"; What I am doing wrong? I tried different values for the ElementId - movie_player, player.... Any help is

How can I see the number of total installs for my chrome extension?

陌路散爱 提交于 2019-12-21 04:40:44
问题 I'm distributing a chrome extension through the Chrome web store and I'm having trouble finding anyplace where the web store tells me how many "total installs" my extension has. I want to be able to know how many people in total have installed my extension since I first uploaded it. Some quick searching on google yielded the following article in the google help section, but I can't find a "details" page that actually shows the "weekly installs" figure. Check it out here. In addition, there's

Avoiding reloading of Google Chrome extension

左心房为你撑大大i 提交于 2019-12-21 04:33:15
问题 I am developing Google Chrome extension. Each time my JavaScript source changes, I find myself having to click "load unpacked extension" again to have the changes take effect. Reloading the extension at each iteration is very tedious. Can it be avoided? 回答1: Depends on the asset, lets review: Asset ----------------------------------------- Action needed popup.html HTML -------------------------- Refresh browser page popup.html JS ------------------------------- Refresh browser page

Is it possible to rewrite url (with extra parameters) with a Chrome extension

一个人想着一个人 提交于 2019-12-21 04:03:30
问题 I am trying to append few extra parameters to the url that user typed (before the page gets loaded). Is it possible to do? For example, if user types www.google.com , I would like to append ?q=query to url (final: www.google.com?q=query . Thanks 回答1: The webRequest API might be what you need. This code goes in your background page: chrome.webRequest.onBeforeRequest.addListener( function(details) { if( details.url == "http://www.google.com/" ) return {redirectUrl: "http://www.google.com/?q