google-chrome-extension

Recommendations for a “Getting started with Greasemonkey” tutorial [closed]

亡梦爱人 提交于 2019-12-21 03:58:09
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . I'm interested in writing some Chrome compatible Greasemonkey scripts, but I'm finding that there are few updated tutorials on how to

Recommendations for a “Getting started with Greasemonkey” tutorial [closed]

▼魔方 西西 提交于 2019-12-21 03:58:07
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 8 years ago . I'm interested in writing some Chrome compatible Greasemonkey scripts, but I'm finding that there are few updated tutorials on how to

Chrome Extension - first link is auto-focused in popup

南笙酒味 提交于 2019-12-21 03:31:06
问题 How do I stop my Google Chrome extension's default action to auto-focus the first link in my popup.html ? I know I could probably do some roundabout hack with JS or change the :focus CSS, but I think this is throwing off something else I'm trying to do and I'd prefer to stop the root cause of it. 回答1: The easiest (and javascript free!) way is to simply add tabindex="-1" to any element which you don't want to receive automatic focus. 回答2: Perhaps auto-focus was intended for a convenience, but

Chrome tab.create and tab.getSelected

夙愿已清 提交于 2019-12-21 03:18:18
问题 I have some problems to pass message from background page to my content_script.js. I hope someone can point out where i am wrong. background.html //in a function function myFunction() { chrome.tabs.create({"url":"myurl","selected":true},function(tab){ updateTab(tab.id); }); } //update Created new tab function updateTab(tabId){ chrome.tabs.getSelected(null, function(tab) { makeRequest(tab.id); });} //make request function makeRequest(tabId) { chrome.tabs.sendRequest(tabId, {greeting: "hello"},

Trying to use chrome.downloads (it's undefined for some reason) [duplicate]

十年热恋 提交于 2019-12-21 02:57:10
问题 This question already has answers here : chrome.tabs returns undefined in content script (4 answers) Closed 2 years ago . I am trying to download a file (image) from a URL via a Chrome Extension using chrome.downloads, but for some reason chrome.downloads is undefined (getting the warning: Cannot read property 'download' of undefined ). I am basing my attempt on example from Google. My test-extension does not have any popup, just a basic manifest and an extremely simply JavaScript file.

Chrome extension: passing variables to a popup

♀尐吖头ヾ 提交于 2019-12-21 02:49:12
问题 I'm trying to create an etension for Google Chrome. I am monitoring page text selection and i want the popup page to recieve the selected text when i click on the popup button. Is there a way to pass variables to a popup? I understand, that messging doen't work for closed popups, so what should i do? 回答1: Once a text is selected send it to a background page where you would store it in lets say textSelection global variable. Once popup is opened you can access this variable with: var selection

An alternative to -webkit-transform: transformY?

吃可爱长大的小学妹 提交于 2019-12-21 02:49:12
问题 I'm creating a chrome extension that displays an iframe on the top of specific pages. This iframe is fixed and placed before opening body tag. To reserve a place for this iframe, I shift down the body including fixed element using CSS : -webkit-transform: translateY(40px); It seems to work fine with many websites, but on some other website such as facebook it causes a problem. a scroll bar is shown on the right side. Is there an alternative that I might try to avoid this problem . Any help

How do I get the window object for a specific tab if I have that tab's tabId?

*爱你&永不变心* 提交于 2019-12-21 02:34:40
问题 I have the tabId of a tab. How do I get it's window object? 回答1: To get the DOM window object from a tabId, you should insert a content script in that tab: chrome.tabs.executeScript(tabId, {code:'var w = window; console.log(w);'}); https://developer.chrome.com/extensions/tabs#method-executeScript Perhaps you'll need to comunicate with your background page: https://developer.chrome.com/extensions/content_scripts#host-page-communication 回答2: The window object as seen inside chrome extensions:

Chrome extension to reload page on load error

混江龙づ霸主 提交于 2019-12-21 02:30:37
问题 Because it isn't possible to use Greasemonkey for this, I want to write a Chrome extension that will reload a page if it initially failed to load. I know how to write a Chrome extension, I've already injected scripts and figured out how to communicate with pages, so I have basic knowledge of how tabs work and how to build my manifest. What events am I looking for and how can I make it work for both GET and POST requests? 回答1: Use chrome.webNavigation.onErrorOccurred or chrome.webRequest

how do i toggle on/off content_scripts in a google extension?

家住魔仙堡 提交于 2019-12-21 02:30:08
问题 I have this simple extension, it displays icon on chrome's toolbar and shows a enable/disable button. i want to add function to the button to disable or enable the content_script.js which fires on visiting google website: popup.js var setLayout = function(){ var list = document.createElement('ul'); var enable = document.createElement('li'); enable.appendChild(document.createTextNode('Enable Script')); enable.onclick = function(){toggle(0)}; var disable = document.createElement('li'); disable