google-chrome-extension

Injecting JS functions into the page from a Greasemonkey script on Chrome

♀尐吖头ヾ 提交于 2019-12-17 03:00:04
问题 I have a Greasemonkey script that works just fine in Firefox and Opera. I struggle with getting it to work in Chrome, however. The problem is injecting a function into the page that can be invoked by code from the page. Here's what I'm doing so far: First, I get a helper reference to the unsafeWindow for Firefox. This allows me to have the same code for FF and Opera (and Chrome, I thought). var uw = (this.unsafeWindow) ? this.unsafeWindow : window; Next, I inject a function into the page. It

Communicate between scripts in the background context (background script, browser action, page action, options page, etc.)

元气小坏坏 提交于 2019-12-17 02:26:30
问题 I am running into an issue sending data from my background script to the script for my pageAction . My content script adds an <iframe /> and the JavaScript in the <iframe /> is receiving the data from my background script, but it does not seem to be retrieved in my pageAction . In my background script I have something like: chrome.tabs.sendMessage(senderTab.tab.id, { foo:bar }); where senderTab.tab.id is the "sender" in onMessage Listener in my background script. In the JavaScript loaded by

Port error while changing chrome extension from manifest v1 to v2

谁都会走 提交于 2019-12-17 02:26:08
问题 While attempting to port the extension from manifest version 1 to version 2, this appeared: Port error: Could not establish connection. Receiving end does not exist. chromeHidden.Port.dispatchOnDisconnect miscellaneous_bindings:232 This appeared in Console in developer tools. I have no idea where to start fixing this cause i don't know what's causing it to begin with.. what can cause this problem? and is there someway to know exactly what's causing it? Thanks. 回答1: The most likely cause of

Unchecked runtime.lastError while running tabs.executeScript?

喜你入骨 提交于 2019-12-17 02:24:58
问题 I managed to build Ripple Emulator open source (https://github.com/apache/incubator-ripple). I built it per the instructions (Jake build), which create the Chrome Extension Target that allows me to test my web apps via a chrome extension of my built, as per https://github.com/apache/incubator-ripple/blob/master/doc/chrome_extension.md. I successfully loaded the unpacked extension onto chrome, but when I enable it nothing happens, though the page reloads the extension does not work, instead I

How can I open my extension's pop-up with JavaScript?

风格不统一 提交于 2019-12-17 02:23:08
问题 I am trying to write a JavaScript function that will open my extension like when the extension icon is clicked. I know how to open my extension in a new tab: var url = "chrome-extension://kelodmiboakdjlbcdfoceeiafckgojel/login.html"; window.open(url); But I want to open a pop-up in the upper right corner of the browser, like when the extension icon is clicked. 回答1: The Chromium dev team has explicitly said they will not enable this functionality. See Feature request: open extension popup

Getting “net::ERR_BLOCKED_BY_CLIENT” error on some AJAX calls

好久不见. 提交于 2019-12-17 02:07:53
问题 Recently I've realised that, some adblocker extensions (such as adBlocker plus) block some Ajax calls. I get that error on the console: GET http://localhost/prj/conn.php?q=users/list/ net::ERR_BLOCKED_BY_CLIENT Why does it block some Ajax call but not the others and what causes that? Is there any workaround other than telling user to turn off adblocker? 回答1: AdBlockers usually have some rules, i.e. they match the URIs against some type of expression (sometimes they also match the DOM against

How to change chrome packaged app id Or Why do we need key field in the manifest.json?

我是研究僧i 提交于 2019-12-17 02:07:12
问题 I'm developing packaged app for chrome store using one-time chrome wallet payments. For my app I need to check during the runtime if user bought the app or not to decide should it be demo functionality or full functionality. According to the chrome identity API documentation : to keep application ID constant, You need to copy the key in the installed manifest.json to your source manifest. I have 2 questions about this procedure: 1) under what condition the id of my application may change? I

Chrome extension: accessing localStorage in content script

对着背影说爱祢 提交于 2019-12-17 01:34:22
问题 I have an options page where the user can define certain options and it saves it in localStorage: options.html Now, I also have a content script that needs to get the options that were defined in the options.html page, but when I try to access localStorage from the content script, it doesn't return the value from the options page. How do I make my content script get values from localStorage, from the options page or even the background page? 回答1: Update 2016: Google Chrome released the

Getting the source HTML of the current page from chrome extension

核能气质少年 提交于 2019-12-17 00:34:16
问题 I have a chrome extension. i need to analyse from the HTML source of the current page. i found here all kinds of solutions with background pages and content scripts but none helped me. here is what i have so far: manifest.json: { "name": "Extension", "version": "1.0", "description": "Extension", "browser_action": { "default_icon": "bmarkred.ico", "popup": "Test.html" }, "content_scripts": [ { "matches": ["http://*/*"], "js": ["content.js"] } ], "background": { "page": "backgroundPage.html" },

Getting the source HTML of the current page from chrome extension

孤街浪徒 提交于 2019-12-17 00:34:12
问题 I have a chrome extension. i need to analyse from the HTML source of the current page. i found here all kinds of solutions with background pages and content scripts but none helped me. here is what i have so far: manifest.json: { "name": "Extension", "version": "1.0", "description": "Extension", "browser_action": { "default_icon": "bmarkred.ico", "popup": "Test.html" }, "content_scripts": [ { "matches": ["http://*/*"], "js": ["content.js"] } ], "background": { "page": "backgroundPage.html" },