google-chrome-extension

Communicating with a content script in a Firefox extension

社会主义新天地 提交于 2020-01-14 06:15:08
问题 I have a Chrome extension which does the following action: chrome.extension.sendRequest({action: "store", working_tab: tab.id, store_text: text}); And Correspondingly, the listener is: chrome.extension.onRequest.addListener(function(request, sender, sendResponse) { if (request.action == "store") { storeObject.process(); sendResponse({}); } } Can you please guide me, what would be the corresponding code for a Firefox Extension? I followed the Firefox Extension tutorial but that didn't help me

How to insert iframe/div to the top of browser body in javascript in chrome extension

拜拜、爱过 提交于 2020-01-14 05:44:09
问题 I am new to chrome extension and did not know how to develop toolbar button in javascript/content script and want to fix it to the top of body(want to push body down). please help. document.body.parent.style.webkitTransform ='translateY(40px)'; var div = document.createElement("div"); div.id="divs"; div.style.display='block'; div.style.width = "600px"; div.style.height = "100px"; div.style.background = "#C2E2FF"; div.style.color = "grey"; div.innerHTML = "my div"; div.appendChild(btn1);

google chrome extension update text after response callback

杀马特。学长 韩版系。学妹 提交于 2020-01-14 04:44:06
问题 I am writing a Google Chrome extension. I have reached the stage where I can pass messages back and forth readily but I am running into trouble with using the response callback. My background page opens a message page and then the message page requests more information from background. When the message page receives the response I want to replace some of the standard text on the message page with custom text based on the response. Here is the code: chrome.extension.sendRequest({cmd:

Chrome-extension URL match patterns:Why rules are not working for Google.com?

荒凉一梦 提交于 2020-01-14 03:05:21
问题 I'm making an extension to customize Google' homepage background.So I write some match rules in manifest like this: "content_scripts": [ { "matches": ["https://www.google.com/", "http://www.google.com/"], "js": ["static/js/jquery.js", "static/js/contentscript.js"] } ], and some scripts in contentscript.js : var imgURL = chrome.extension.getURL("static/images/bg.jpg"); $('body').css('background-image', 'url(' + imgURL + ')'); The script works fine for https://www.google.com, but when I try to

How to send the message from popup.html to content script?

和自甴很熟 提交于 2020-01-14 02:41:40
问题 I am making an extension and want to pass the message from the popup.html to content.js but the following code alert undefined . Please give me a simple script that send message from popup.html to content.js and vice versa, further i will handle it. I want to access the DOM through this extension for modifying and designing the website layouts. Manifest { "manifest_version": 2, "name": "Extension", "description": "Description", "version": "1.0", "background": { "scripts": ["background.js"],

Guidance for building a Google chrome extension in Python

旧时模样 提交于 2020-01-13 19:25:08
问题 I would like to build a chrome extension in python(because Javascript would be completely new to me!). There are multiple things that I want to do and finding a hard time wrapping my head around to understand if it is possible and what tools would be needed. The extension would display the results of web scraping(using Scrapy) a page. Scraping the page and updating the results on the extension need to be done every 5 minutes. I do know that Pyjs is one of the options, but it isn't clear to me

“document_start” for Firefox addon?

走远了吗. 提交于 2020-01-13 18:11:28
问题 I come from Chrome extensions, so I'm used to defining when a file should be injected by setting run_at , e.g., to document_start for injection before DOM construction. Is there an equivalent for Firefox addons? 回答1: Yes, the equivalent would be the content-document-global-created notification. An extension can add an observer for that notification and then do something with the window - like injecting a content script. See How to override JS function from a firefox extension? for one example

Google sheets API with chrome extension, how to use?

夙愿已清 提交于 2020-01-13 18:10:31
问题 I am making my first chrome extension. My idea is to call Google Sheets API to append a row in a google spreadsheet from my extension. I am referring this link for the same and successfully tried the API to append row in my desired sheet. Now I am trying to do the same from my chrome extension code files. How do you use the same sample code for your extension as our extension will not allow inline js. Any sample or basic boilerplate would help. Many thanks in advance. 回答1: You are receiving

Javascript (typescript) Chrome extension, function callback as promises?

巧了我就是萌 提交于 2020-01-13 14:06:54
问题 for a code like this let anotherFolder='whatever'; let anotherFolder2='whatever'; chrome.bookmarks.create( {title:'whatever2'}, function( parentFolder ) { chrome.bookmarks.move( anotherFolder, {parentId: parentFolder.id}, function() { chrome.bookmarks.removeTree( anotherFolder2, function() { resolve(); }); }); }); can I transform it to chain functions? Something like let anotherFolder='whatever'; let anotherFolder2='whatever'; return new Promise(function(resolve){ chrome.bookmarks.create(

Javascript (typescript) Chrome extension, function callback as promises?

这一生的挚爱 提交于 2020-01-13 14:04:06
问题 for a code like this let anotherFolder='whatever'; let anotherFolder2='whatever'; chrome.bookmarks.create( {title:'whatever2'}, function( parentFolder ) { chrome.bookmarks.move( anotherFolder, {parentId: parentFolder.id}, function() { chrome.bookmarks.removeTree( anotherFolder2, function() { resolve(); }); }); }); can I transform it to chain functions? Something like let anotherFolder='whatever'; let anotherFolder2='whatever'; return new Promise(function(resolve){ chrome.bookmarks.create(