google-chrome-extension

Can you use javascript in a page action popup?

谁说胖子不能爱 提交于 2020-01-11 08:47:07
问题 I'm trying to build a chrome extension that uses the page action popup feature, but none of my javascript seems to be working. Here is the source: <!DOCTYPE html> <html> <body> <input type="button" id="button1" value="first button"> <input type="button" id="button2" value="second button"> <script> console.log("do anything!!"); </script> </body> </html> I can't see the logger statement anywhere. I can't seem to get anything to run. Is this how popups are supposed to work? The docs make no

using chrome.experimental.webRequest API to change loaded file?

≡放荡痞女 提交于 2020-01-11 06:21:10
问题 I'm trying to use webRequest API to change the loaded .swf file on a webpage... The page loads a file called chat.swf, but i want to redirect to chat2.swf in the same directory in order to use the other file. I was told that this could work, but I have no idea how to use this API correctly and I cannot find any examples @_@ function incerceptChat(chat){ console.log( "onBeforeRequest", details ); if(chat.url == swf1){ chat = swf2; } } that's my function that's supposed to change the URL, but I

How can I add a Chrome extension listener both onStartup and onInstalled?

社会主义新天地 提交于 2020-01-11 04:56:07
问题 The chrome.runtime API has a few events that I can use to add a listener to a context menu. At the moment I'm using chrome.runtime.onStartup like so: chrome.runtime.onStartup.addListener(function() { chrome.contextMenus.create({ 'title': 'Add: %s', 'contexts': ['selection'] }); }); chrome.contextMenus.onClicked.addListener(onClickHandler); The problem is that chrome.runtime.onStartup will work when the user starts or restarts Chrome, and chrome.runtime.onInstalled will work when the extension

chrome.storage.local.get results in “Undefined” when called

不羁岁月 提交于 2020-01-11 03:15:08
问题 I'm building a chrome extension, and I needed to save some data locally; so I used the Storage API . I got to run the simple example and save the data, but when I integrated it with my application, it couldn't find the data and is giving me "Undefined" result. Here is my Code: function saveResults(newsId, resultsArray) { //Save the result for(var i = 0; i < resultsArray.length; i++) { id = newsId.toString() + '-' + i.toString(); chrome.storage.local.set({ id : resultsArray[i] }); } //Read and

Access window object from a background Chrome extension

时间秒杀一切 提交于 2020-01-11 02:32:11
问题 I want to access the properties of a window object from a background script. I have this in manifest.json : { "..": "..", "permissions": ["http://*.mysite.net/"], "background": { "scripts": ["extension.js"] } } and this in extension.js : chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) { if (changeInfo.status === 'complete') { var tabWindowObject = ?? setInterval(tabWindowObject.someFunction, 10); } }); I need it here, not in another place (no content scripts and no script

chrome.storage is undefined in chrome extension

醉酒当歌 提交于 2020-01-11 02:05:47
问题 I'm developing a Google Chrome extension, and have been working on one for a while. So it's been installed for a while, and I updated the manifest file to include the "storage" permission and reloaded the extension. However, when I try it in the console, chrome.storage is undefined . I restarted Chrome and still nothing. My manifest file looks like this: { ... snip ... "permissions": [ "tabs", "http://*/*", "https://*/*", "chrome://favicon/", "storage" ] } I could reinstall the application,

Chrome extension to redirect tab to my page

ⅰ亾dé卋堺 提交于 2020-01-10 16:27:13
问题 I am new to chrome extensions and I am having trouble while writing my first extension for chrome. What I am trying to do is detect the new tab action and redirect to a pre-defined(my webpage) url. I wrote the manifest.json and the background.html but it doesn't seem to work. I went through the google papers on the functions and how to use them, but there must be something I've missed. I do not understand quite a few things that I've done in here, for example the content-scripts in manifest

Having panel behavior in chrome extension

别说谁变了你拦得住时间么 提交于 2020-01-10 08:07:11
问题 I need to have panel behavior in chrome: something always on top but that does not impair the navigation (in any other way than masking a few pixels). We have two options at the moment: window in panel mode: not available yet (although it is available now to the GTalk extension). window in popup mode: I can make it be always on top by refocusing at every event, however the focus will get targeted at my window (and impair the navigation) I'm looking for either: GTalk's dark magic A way to make

Having panel behavior in chrome extension

心不动则不痛 提交于 2020-01-10 08:06:29
问题 I need to have panel behavior in chrome: something always on top but that does not impair the navigation (in any other way than masking a few pixels). We have two options at the moment: window in panel mode: not available yet (although it is available now to the GTalk extension). window in popup mode: I can make it be always on top by refocusing at every event, however the focus will get targeted at my window (and impair the navigation) I'm looking for either: GTalk's dark magic A way to make

Using a variable key in chrome.storage.local.set [duplicate]

梦想与她 提交于 2020-01-10 03:05:14
问题 This question already has answers here : chrome.storage.local.set using a variable key name (2 answers) Closed 3 years ago . I am creating a chrome-extension. I don't know how to use a variable as the key to chrome.storage.local.set() function. I have tried var key = 'myKey'; chrome.storage.local.get(key, function(val) { chrome.storage.local.set({key:val[key]+param1}); //appending param1 alert(val[key]); } Here i am trying to get the value of val[key] and append a string param1 and place it