google-chrome-extension

What is difference between chrome.webNavigation.onCompleted and chrome.tabs.onUpdated.addListener with 'complete'

别等时光非礼了梦想. 提交于 2019-12-21 17:52:48
问题 In chrome APIs there are two functions that theoretically points to the same evet. chrome.webNavigation.onCompleted and chrome.tabs.onUpdated.addListener with changeinfo=complete . What is the difference between these two and which one guarantee that everthing in the page have loaded. I have found that chrome.tabs.onUpdated.addListener sometimes fire even when few http requests are remaining. 回答1: The chrome.webNavigation.onCompleted is invoked even when the navigation occurs in a subframe

How to get Latest Chrome (Version 55) to allow mixed content?

拜拜、爱过 提交于 2019-12-21 17:39:37
问题 I have a chrome extension that communicates using HTTP in development and HTTPS in production. I run it from webpages that use HTTPS. When I use this extension in my development mode I get the following error. Mixed Content: The page at 'https://somesite.com' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://david-sniper.local:3001/api/end-point'. This content should also be served over HTTPS. In the past I have been able to resolve this error by going reading

chrome extension dynamically change icon (without clicking)

我们两清 提交于 2019-12-21 17:20:05
问题 how can I make my chrome extension change icon (without clicking on it). I've got script that's checking if page has certain string and if it has I want my extension icon change from grey to colored one. 回答1: The content script will need to send a message when it wants to set the icon e.g. chrome.runtime.sendMessage({ action: 'updateIcon', value: false }); Then in the background script: chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) { if (msg.action === "updateIcon"

Encrypt Chrome-extension?

女生的网名这么多〃 提交于 2019-12-21 13:03:51
问题 Anyway to encrypt a Chrome-extension from not exposing the source code? 回答1: you can hide your code using obfuscator. there are lots of available in market. there are few tools like Google Closure compiler, and lots of online javascript ofuscators are available in market. you can use any. but it doesn't guarantee the confidentialness of the code. anyone expert with javascript can de-obfuscate that code. Here are two methods: 1. make your functionality available via web services. so important

Youtube iframe API: OnReady not firing for Chrome extension

此生再无相见时 提交于 2019-12-21 12:55:08
问题 I'm trying to build a Chrome extension to show a Youtube video using Youtube's iframe API. However, the player's OnReady event never fires. From previous posts here I gather this is due to the fact that Youtube cannot access the player because it is a local instantiation. I wonder: is there a way to make this work? My code instantiates the player in a popup. I want to play new videos to the player by passing the video ID to the player's loadVideoById function. Here's the code of my player (in

How to get browsing history using history API in Chrome extension

人盡茶涼 提交于 2019-12-21 12:35:49
问题 How can I get the URLs of recently visited tabs using chrome.history API, specifically, the last 10 URLs visited? 回答1: Pass an empty string as your query to the search() method of the chrome.history API. For example, this will log the 10 most recently visited URLs to the console: chrome.history.search({text: '', maxResults: 10}, function(data) { data.forEach(function(page) { console.log(page.url); }); }); 来源: https://stackoverflow.com/questions/24894627/how-to-get-browsing-history-using

JavaScript click() method only works once in Chrome extension

你说的曾经没有我的故事 提交于 2019-12-21 12:18:12
问题 I'm trying to download multiple files in a Chrome extension. The following code creates a dummy link to a file, then triggers the .click() event which downloads the file. The problem is that only the first .click() event triggers a download. Subsequent .click() events are ignored. Here the manifest.json : { "name": "Simple File Downloader", "version": "0.1", "permissions": ["contextMenus", "http://*/"], "background": { "persistent": false, "scripts": ["sample.js"] }, "content_security_policy"

chrome extension to Send Message from popup to content script

北战南征 提交于 2019-12-21 12:06:29
问题 I,am developing an extension in which i have to extract data from linkedin profile page when user press button on popup. I,am passing message from the popup.js page to contentscript and in response i will get data extracted from linkedin profile page by contentscript so that i can display it in popup.html. But I,am getting error when i inspected the popup.html. The error is: Port: Could not establish connection. Receiving end does not exist. lastError:29 Error in event handler for 'undefined'

Proper way to listen as TCP server in Chrome extension

泄露秘密 提交于 2019-12-21 11:26:09
问题 I want to create a TCP server and listen on it. I need access to the tab content, so I need a chrome extension. Sadly, only chrome apps can create TCP servers. Is it a valid/good concept to create a TCP server in a chrome app and let the app communicate with an extension (is this even possible?)? If not, what would be my alternatives? The only idea I have is to change from server model to client model and let the extension connect to an external server. This solution would be poor in my

chrome.runtime.onStartup never fires?

蓝咒 提交于 2019-12-21 11:00:13
问题 Consider the following Chrome extension: manifest.json { "name": "Test onStartup", "version": "0.0.0", "manifest_version": 2, "background": { "persistent": false, "scripts": ["eventPage.js"] }, "permissions": ["storage"] } eventPage.js chrome.runtime.onStartup.addListener(function() { console.log("I started up!"); chrome.storage.local.set({"startedUp": true}); }); chrome.runtime.onStartup is documented as firing "when a profile that has this extension installed first starts up", and I would