How to add notification in chrome extension.

1,394 views
Skip to first unread message

RubaN Silva

unread,
Nov 4, 2014, 1:43:52 AM11/4/14
to chromium-...@chromium.org
Hi, 
I am newbie to create chrome extension. I created one chrome extension that fetches latest news from rss feed. I need a notification on the right top of the icon of my own when i post any news in my site.

Thanks

Zachary Yaro

unread,
Nov 4, 2014, 11:23:46 AM11/4/14
to RubaN Silva, Chromium Extensions
I personally do not have anything very simple in my own projects, though my Rizzoma Notifier extension uses browser action badges.  Is your code available to view somewhere?


Zachary Yaro

On Tue Nov 04 2014 at 11:14:32 AM RubaN Silva <frsrub...@gmail.com> wrote:
Hi Zachary,
Could you please share me any example with browser action badge. This what i want. I tried this but its not showing notification. I dont know how to do it.

Thanks,
Ruban

On Tue, Nov 4, 2014 at 9:05 PM, Zachary Yaro <zmy...@gmail.com> wrote:
I am not sure I understand what sort of notification you want to create.  To display a short bit of content, you could use desktop notifications.  If you want to add, for instance, an unread count on top of your extension icon, you could use a browser action badge.


Zachary Yaro

--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extensions+unsub...@chromium.org.
To post to this group, send email to chromium-extensions@chromium.org.
Visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/98e0b7f3-7776-446a-8682-0c3be463c404%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.


Antony Sargent

unread,
Nov 4, 2014, 1:43:18 PM11/4/14
to Zachary Yaro, RubaN Silva, Chromium Extensions
Browser actions support a bit of badge text, optionally with a background color. See



To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.

Zachary Yaro

unread,
Nov 5, 2014, 9:18:14 AM11/5/14
to RubaN Silva, Chromium Extensions
I commented on the Stack Overflow post, but I will repost my comment here.  If you are trying to display a browser action badge (a small number that appears on top of your extension's toolbar icon), you can set/change that by calling chrome.browserAction.setBadgeText.  The code you posted on that Stack Overflow post does not call any chrome.* APIs.

Zachary Yaro

On 4 November 2014 23:03, RubaN Silva <frsrub...@gmail.com> wrote:
Hi zachary,
Sorry for the late reply, i have send the link in which i have placed the code of mine. check it.

Please do the needful. I was struggling with this for more than a week.

Thanks,
Ruba

Zachary Yaro

unread,
Nov 5, 2014, 2:50:30 PM11/5/14
to RubaN Silva, Chromium Extensions
As stated in the API documentation, chrome.browserAction.setBadgeText takes an object literal as its only argument, and that object literal contains the arguments you want to pass.

For example, to display “hello” in a browser action badge, you would use the following command:
chrome.browserAction.setBadgeText({ text: 'hello' });

Zachary Yaro

On 5 November 2014 12:31, RubaN Silva <frsrub...@gmail.com> wrote:
Hi Zachary,
Where i want to put chrome.browserAction.setBadgeText in my code. i tried chrome.browserAction.setBadgeText('text'), but its showing 1 as a notification all time..

Thanks,
Ruban 
Reply all
Reply to author
Forward
0 new messages