content-script

Chrome extension: sendMessage from background to content script doesn't work

倾然丶 夕夏残阳落幕 提交于 2019-12-17 15:34:32
问题 I know that question has been repeatedly asked in different ways, but I tried to go through all the answers (hopefully I didn't miss anyone) and none of them worked for me. Here is my extension's code: manifest: { "name": "test", "version": "1.1", "background": { "scripts": ["contextMenus.js"] }, "permissions": ["tabs", "<all_urls>", "contextMenus"], "content_scripts" : [ { "matches" : [ "http://*/*" ], "js": ["jquery-1.8.3.js", "jquery-ui.js"], "css": [ "jquery-ui.css" ], "js": ["openDialog

Overriding !important with css or jquery

我的未来我决定 提交于 2019-12-17 07:10:45
问题 (This is using content scripts in a chrome extension) I need to overwrite some css properties that the webpage has labeled as !important . Is this possible? For instance, if I want to get rid of the border that is labeled important: $(".someclass").css('border','none'); //does not work 回答1: Here you go: $( '.someclass' ).each(function () { this.style.setProperty( 'border', 'none', 'important' ); }); Live demo: http://jsfiddle.net/Gtr54/ The .setProperty method of an element's style object

Optionally inject Content Script

此生再无相见时 提交于 2019-12-17 05:04:25
问题 Content Script can be injected programatically or permanently by declaring in Extension manifest file. Programatic injection require host permission, which is generally grant by browser or page action. In my use case, I want to inject gmail, outlook.com and yahoo mail web site without user action. I can do by declaring all of them manifest, but by doing so require all data access to those account. Some use may want to grant only outlook.com, but not gmail. Programatic injection does not work

My CSS is not getting injected through my content script

天大地大妈咪最大 提交于 2019-12-17 03:37:11
问题 Can anyone explain this to me. I'm trying to inject a CSS file onto a webpage using the content_script with Google extensions, but my css file never gets added to the webpage. Can someone tell me what I'm doing wrong and help me fix it? thanks Manifest: { "name": "Extension", "version": "0", "description": "", "permissions": ["tabs", "http://*/*", "https://*/*", "file:///*/*"], "content_scripts": [ { "matches": [ "http://*/*", "https://*/*", "file:///*/*"], "css": ["myStyles.css"], "js": [

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

Chrome Extension to change text style of specific website

你说的曾经没有我的故事 提交于 2019-12-14 02:52:44
问题 So, I'm trying to make a chrome extension for this website www.twitch.tv, it has a chat and I'm trying to change the color of my name in it. See images below. From (left), to (right): I have my manifest.json file with a content_script. So I want to change my name "nickeaules" on that specific site to another color, and I have no idea to begin with this as I have never made a Chrome extension before. Is this possible with some simple code? Or is it way to complex to code? 回答1: You can use

HTML5 File API in Firefox Addon SDK

吃可爱长大的小学妹 提交于 2019-12-13 14:21:02
问题 Is there a way to access Html5 file api in Fire Fox addon sdk in the content script? This is needed in order to store user added words and their meanings. The data can grow large and so local storage isn't an option. window.requestFileSystem3 = window.requestFileSystem || window.webkitRequestFileSystem; gives me the error TypeError: window.requestFileSystem3 is not a function . I am asking this because i am porting this code from a Google Chrome Extension which allows accessing the file api

Firefox Addon - Accessing pre-loaded content script from ActionButton

我的梦境 提交于 2019-12-13 12:39:03
问题 I am attaching content script to every tab on my firefox add-on. And if user clicks on ActionButton (top right icon on browser) I am trying to access content script handler function, but it does not work. I am using walkthroughs from Content Scripts but still could not make it work. Am I doing something wrong? Please see code below the TODO marked areas are not working; // main.js tabs.on('ready', function (tab) { var worker = tab.attach({ include: "*", //contentScript: 'window.alert("Page

Modify page element as soon as it's loaded

喜欢而已 提交于 2019-12-13 09:49:43
问题 I'm currently writing a very simply Google Chrome Extension that utilizes Content Scripts, to simply add additional text onto a webpage by grabbing the element and appending to its innerHTML when the page is finished loading. The issue is that the webpage I'm modifying is rich in media and takes several seconds to load, thus causing the additional text to not display until a few seconds after the rest of the text has loaded. The element I'm grabbing is a span . Is there any way of listening

How to make a static HTML as a chrome extension?

跟風遠走 提交于 2019-12-13 07:57:19
问题 I want to make a Chrome extension basically constituted as a HTML bar staying at the top of the user window all the time (after he activates it). The bar position would be something "like" it: My question is: how can I achieve this behavior? I thinked about adding it as "browser action"at the manifest, but it does not fits since it disappears when loses focus. I also tried to add it as a content script , "embracing" my HTML with simple JS command document.write(HTML line) , but I can see no