System tray icon for Chrome extension - javascript

My manifest includes a nice icon and my background.js page triggers the extension's main functionality.
Is there some easy way to get the exact same functionality within the notification tray? In other words, is there any way to put an icon in the task bar (like google does with the hangouts extension), and trigger a single event when it is clicked.
Here is the code I use for the action button in the browser itself:
chrome.browserAction.onClicked.addListener(function(tab)
{
mainFunction();
});
I'd imagine there is a simple addition to the manifest along with a simple line like the above, that would achieve my desired result.

Chrome extensions don't have access to the system tray, and there is no API for that.
Hangouts is specifically whitelisted in the Chromium source code to get some special privileges.

Related

Question about messaging passing in Google Chrome Extension

In my content script, it's looking for certain keywords in the webpages title. If they are found, I want it to display a notification, using Google's notification API. However, you can't use google's notification API in the content.js - apparently it needs to be in a background file. Any idea how I do this?

HTTP address with Javascript inside address

I'm looking for very specific way to open links or create shortcuts to open links with already loaded Javascript on website.
For example. I have portal to which I have link:
example.com/text/nu#action:projmgr.text&id123456 but on site there is gear icon which have to be activated and then selected Export to Excel (Data Only) which is a JavaScript link like javascript:text.text.exportToFile('npt.(...)'500','text.text').
I have like 50 lists to export by clicking on the first link and then navigate through those steps.
Is it possible to create shortcuts to Javascript?
Thanks in advance.
No.
It would be a enormous (XSS/CSRF) security problem if a URL could be constructed which caused a browser to visit a URL and execute arbitrary JavaScript or follow links.
Consider using a tool like Selenium or PhantomJS instead.

how to disable javascript in chrome by code

we kown that chrome provide us the method to disable js in web developer Panel.
but i want to disable js from chrome extension by the interface if chrome provide
if chrome dont allow developer do this ,
if i can get the list of the element banned loading when set disabled in panel.
thank you
If you're trying to stop a particular script from loading (is that right?), consider using Chrome's webRequest API to stop it from even being loaded in the first place. The API reference contains an example of how to cancel a request. (Note that the first example is for demonstration purposes; the second example is more efficient if you know the URL in advance.)

Google chrome notifciations icons without 'web_accessible_resources'

I'm currently working on a google chrome extension which needs to use notifications.
It's meant to extract an image from a site (got that part), upload it to imgur and then use it as the icon for the notification. My problem is:
All icons have to be listed under 'web_accessible_resources' before being used in a notification. However, my problem is that I create the icon while the extension is already running and I therefore cannot add it to the manifest.
Is there any workaround for this?
Try a data URI. This is extra text to reach the 30-character minimum.

How to get notified when user clicked anywhere in a webpage

I want to build a extension similar to Chrome dictionary . For building that i my extension should be notified when user left clicked on a webpage on any tab.
I searched all over the chrome.* APIs but failed to find that kind of event. Also tried googling with this query : "how to get notified when user clicks on a webpage in chrome api". Failed to get any result.
Is this prohibited in chrome api ? I found that Extensions can't listen to tabs and navigation buttons but as far as i understand that is not relevant with my issue.
Any suggestion in how to get this done is highly appreciated.
You'll need to attach a content script to all pages
Google Chrome Extensions: Content Scripts
In that script attach a listener to the document to catch all clicks (like #Jashwant said) then pass a message back to your extension to perform some behaviour:
Google Chrome Extensions: Message Passing

Categories