content-script

chrome extension to Send Message from popup to content script

余生颓废 提交于 2019-12-04 04:17:19
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': Cannot read property 'farewell' of undefined TypeError: Cannot read property 'farewell' of undefined

$x() function is not defined inside a Chrome extension, content script

我怕爱的太早我们不能终老 提交于 2019-12-04 03:45:49
$x("//a[contains(@href,'.jpg')]"); works as expected from the developer tools command prompt. But, when in an extension's content-script I get a ' $x is not defined '. Why is this not available in a content-script or is there a special way of accessing it inside a content-script / Chrome extension? I'm using Chrome 22 on Debian. $x() is not part of the run-time environment of a web page or content script. It is a tool that is part of the Command Line API for Chrome's DevTools . To use XPath in a content script, you need to do it the normal way, the DevTools convenient shortcut is not available

POST request on Facebook.com in Chrome Extension fails

房东的猫 提交于 2019-12-04 02:35:20
问题 I have a Chrome Extension that sends AJAX POST with some data on every page. The problem is that, Facebook block the AJAX request resulting this: Refused to connect to 'URL_HERE' because it violates the following Content Security Policy directive: "connect-src https:// .facebook.com http:// .facebook.com https:// .fbcdn.net http:// .fbcdn.net *.facebook.net .spotilocal.com: https:// .akamaihd.net ws:// .facebook.com:* http://*.akamaihd.net". How to send AJAX call to my server on that page

From a browser action popup: open a new tab and fill input fields

对着背影说爱祢 提交于 2019-12-03 18:14:04
问题 I'm trying to build a basic Chrome extension that, from a browser action popup, opens a website in a new tab, and fills in the login credentials. I can get the Chrome extension to open the new page but can't seem to get it to input text into the input fields. Manifest.json { "manifest_version": 2, "name": "Vena", "description": "This extension will allow users to login to vena accounts", "version": "1.0", "browser_action": { "default_icon": "images/icon.png", "default_popup": "popup.html" },

Javascript not always working in Chrome Extension, when should I run it?

不羁岁月 提交于 2019-12-03 16:48:30
I have a Chrome Extension which is injecting both CSS and Javascript into the page, and while the CSS is always being injected, the Javascript is only working sometimes and not others. By not working, I assume it's running before the stuff exists that it has to deal with. The Javascript is simply moving a div above another using insertBefore but this isn't always happening, and I assume it's because of when it's loading. My manifest is currently: { ... "content_scripts": [{ "matches": [ "*://example.com/*" ], "js": [ "js/jquery-1.8.3.min.js", "js/myjavascript.js" ], "run_at": "document_end",

Chrome Extension Send Message From Background.js to Content Script

半世苍凉 提交于 2019-12-03 15:09:27
问题 I have read the documentation on how to do Send Message From background javascript file(main.js) to Content Script (content.js) but I cannot get the onMessage to open my alert. Manifest.json { "name": "Example", "version": "1.0.1", "manifest_version" : 2, "description": "Example Description", "background" : { "scripts" : ["main.js"] }, "page_action" : { "default_icon": { "19": "icons/19.png", "38": "icons/38.png" }, "default_title" : "Example Title" }, "content_scripts": [{ "matches": ["<all

what are content scripts in chrome inspector

我的未来我决定 提交于 2019-12-03 10:15:07
While this could be a very basic thing, I can't seem to find an answer to this one. I see a lot of discussion about content scripts . When I open web inspector in chrome , and select sources , I see a tab called content scripts . I see a couple of random numbers and a number of scripts and I can't seem to figure out what these are. How are these being shown? where are these coming from? I can't see my server serving any of these. Brock Adams In Google Chrome, content scripts are JavaScript files that are part of browser extensions. They operate on the web page much like regular javascript does

Adding @font-face stylesheet rules to chrome extension

↘锁芯ラ 提交于 2019-12-03 09:35:12
问题 What is the recommended way to add a @font-face stylesheet rule through a chrome-extension? The problem is that the url of the font embed is located from within the extension, so I must do it in javascript in order to use chrome.extension.getURL . I have tried document.styleSheets[0].addRule through a content-script, but that did not work. To clarify, I also have the font listed under web_accessible_resources. 回答1: Inject a <style> node, in your content-script. Something like so: var

Selecting <option> of a <select> from a chrome extension content script

╄→尐↘猪︶ㄣ 提交于 2019-12-03 08:04:36
I'm hoplessly trying to activate a change() event from a chrome content script. I've gone past through of the website and google posts, but still nothing works. here's a description of what i'm tryin to achieve consider the following webpage (reachable via http://www.gilzu.com/TFF/select.html should someone be so kind to help) : <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>Untitled Page</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function () { $('#woot').die('change'); $('#woot').live('change', function () { $

Chrome Extension Send Message From Background.js to Content Script

拟墨画扇 提交于 2019-12-03 04:55:55
I have read the documentation on how to do Send Message From background javascript file(main.js) to Content Script (content.js) but I cannot get the onMessage to open my alert. Manifest.json { "name": "Example", "version": "1.0.1", "manifest_version" : 2, "description": "Example Description", "background" : { "scripts" : ["main.js"] }, "page_action" : { "default_icon": { "19": "icons/19.png", "38": "icons/38.png" }, "default_title" : "Example Title" }, "content_scripts": [{ "matches": ["<all_urls>"], "js": ["lib/jquery-1.8.3.min.js","scripts/content.js"], "run_at": "document_idle", "all_frames