Closed Bug 594543 Opened 14 years ago Closed 11 years ago

Implement Desktop Notifications in Firefox

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 782211

People

(Reporter: dougt, Assigned: wchen)

References

(Blocks 1 open bug, )

Details

+++ This bug was initially created as a clone of Bug #573588 +++

I reviewed the WebNotification spec:
   http://dev.w3.org/2006/webapi/WebNotifications/publish/

and the google spec:
   http://code.google.com/p/gears/wiki/NotificationAPI


and I think both are a bit more complex than we need.


My current thinking is title, description, uri to image, and a callback for if/when the user clicks on the notification:

navigator.notification.notify("title",
                              "description",
			      "uri to image",
			      function() {})




I cloned this bug to track the Firefox specific issues.
Depends on: 595094
Blocks: 595437
Sorry for spamming, but is there a plan to include this bug in ff4? It would be really great, and besides there is already implementation in fennec why not ff.

I know there was feature freeze already, but it looks like all underlying infrastructure is already in place.
No, this won't make FF4. The feature freeze is there for a reason, we at some point have to stop adding new things and work on finishing the things that are already added. A browser that isn't finished isn't good for anyone.

However we'd love to have you help us finishing this feature for next release. Writing tests is something everyone can help with.
> However we'd love to have you help us finishing this feature for next release.
> Writing tests is something everyone can help with.

For some time now I'm looking at how could I start to contribute to firefox code, but it all looks so intimidating for a .net developer with basic c++ skills.
If you or anyone can point me to right direction on how and where to start I would be more than happy to start with writing tests.
I'll just point you at <https://developer.mozilla.org/en/Mochitest>; if you need any more help, feel free to ask here or on irc.mozilla.org #developers.
Dougt, how much work is needed to make it work in Firefox Desktop?
Working draft: http://www.w3.org/TR/notifications/

Chromium has implementation of this api with "webkit" prefix. (http://www.chromium.org/developers/design-documents/desktop-notifications/api-specification)
Here is example: http://www.html5rocks.com/en/tutorials/notifications/quick/

You've already have this api in Fx mobile. It will be great if you implement notifications in desktop version.
(In reply to Alexey Androsov from comment #8)
> Chromium has implementation of this api with "webkit" prefix.
> (http://www.chromium.org/developers/design-documents/desktop-notifications/
> api-specification)
> Here is example: http://www.html5rocks.com/en/tutorials/notifications/quick/

Speaking as someone who has actually used this API for a non-trivial, real world application, the functionality that Chrome implements here is very nearly useless.  For starters, the notifications are ugly and very much out of place platform-wise, particularly on operating systems that have native (or standardized) notification systems (e.g. Growl, NotifyOSD, etc).  To make matters worse, there isn't sufficient flexibility in the API to fix this problem with custom styling.  So, not only are the notifications out of place in terms of the native platform, they're also out of place in terms of the application itself.  Second, the user action restriction on just *requesting* notification permission is incredibly onerous.  Permission requests are important, but restricting the call chain to user actions makes it nearly impossible to even educate users about the feature without bugging them non-stop (which is actually what Gmail does running under Chromium).  Finally, Chromium has a slew of bugs, both in this feature and in other areas, that make the functionality very difficult to use (e.g. document focus tracking is basically a coin flip).  This isn't actually part of the notifications implementation, but it is *very* closely related as any application which wants to use notification will probably also want to work with these other features.

tl;dr: Don't make the mistake of treating Chromium's implementation as the gold standard.  Not only is it not an implementation of the W3C draft (which has advanced quite a bit since Chromium introduced their version), but it's buggy, annoying and provides a very sub-par experience.
I too would love to see "Desktop Notifications" support built-in to Firefox (I am currently using the "HTML5 Notfications" extension at http://code.google.com/p/ff-html5notifications/ but it is quite 'rough'.)

In fact, Chrome's native support for these desktop notifications nearly caused me to switch from Firefox to Chrome permenantly after using it as my sole browser for over 6 years.

I understand your argument Daniel but users want functionality and features regardless of how elegant the underlying APIs are - perhaps Firefox should lead the way here by properly implementing the W3C draft?
(In reply to Ben Kennish from comment #10)
> I too would love to see "Desktop Notifications" support built-in to Firefox
> (I am currently using the "HTML5 Notfications" extension at
> http://code.google.com/p/ff-html5notifications/ but it is quite 'rough'.)
> 
> In fact, Chrome's native support for these desktop notifications nearly
> caused me to switch from Firefox to Chrome permenantly after using it as my
> sole browser for over 6 years.
> 
> I understand your argument Daniel but users want functionality and features
> regardless of how elegant the underlying APIs are - perhaps Firefox should
> lead the way here by properly implementing the W3C draft?

Seriously? Was Desktop notifications the real cause for the switch? I am not saying that this is a great feature or a bad one. But its usage is very limited.

Still one thing to note, Firefox had had it from ages, the small prompt on the bottom left about a new update, or a "All Downloads are Finished" prompt are all types of desktop notifications, even though not implemented up to the W3C draft.

If you just want feature, then there are some addons which implement something like desktop notifications only, for example GPUM for gmail : https://addons.mozilla.org/en-us/firefox/addon/gpum/ (it gives desktop notifications for new mails etc).

I hope my reply helped, and was not offensive as such. :)
(In reply to Ben Kennish from comment #10)
> I too would love to see "Desktop Notifications" support built-in to Firefox
> (I am currently using the "HTML5 Notfications" extension at
> http://code.google.com/p/ff-html5notifications/ but it is quite 'rough'.)
> 
> In fact, Chrome's native support for these desktop notifications nearly
> caused me to switch from Firefox to Chrome permenantly after using it as my
> sole browser for over 6 years.
> 
> I understand your argument Daniel but users want functionality and features
> regardless of how elegant the underlying APIs are - perhaps Firefox should
> lead the way here by properly implementing the W3C draft?

Seriously? Was Desktop notifications the real cause for the switch? I am not saying that this is a great feature or a bad one. But its usage is very limited.

Still one thing to note, Firefox had had it from ages, the small prompt on the bottom left about a new update, or a "All Downloads are Finished" prompt are all types of desktop notifications, even though not implemented up to the W3C draft.

If you just want feature, then there are some addons which implement something like desktop notifications only, for example GPUM for gmail : https://addons.mozilla.org/en-us/firefox/addon/gpum/ (it gives desktop notifications for new mails etc).

I hope my reply helped, and was not offensive as such. :)
(In reply to scrapmachines from comment #12)
> Seriously? Was Desktop notifications the real cause for the switch? I am not
> saying that this is a great feature or a bad one. But its usage is very
> limited.

I'm guessing it is not the only cause but if browsers are to become the place to run apps in there should be a way to communicate with the user through the myriads of tabs they have open. I believe webkit notifications to be the right way to do that and I strongly believe that it should work across browsers.

> Still one thing to note, Firefox had had it from ages, the small prompt on
> the bottom left about a new update, or a "All Downloads are Finished" prompt
> are all types of desktop notifications, even though not implemented up to
> the W3C draft.

Are these visible on top of all open apps?

> If you just want feature, then there are some addons which implement
> something like desktop notifications only, for example GPUM for gmail :
> https://addons.mozilla.org/en-us/firefox/addon/gpum/ (it gives desktop
> notifications for new mails etc).

Well, certainly that would be possible, but I would tell our users to switch to chrome for the full experience. Going through the hassle of creating a custom add-on for Firefox and Safari would just not be worth it.

> I hope my reply helped, and was not offensive as such. :)

Me, I'm happy to finally see any change on this ticket...
hehe no offense taken.  tbh, I decided to run Chrome and Firefox in parallel for two reasons : 1. The current version of Firefox at the time had a bug/problem with the BBC iPlayer website and I was unable to add 'favourites' (this is no longer the case), 2. I wanted desktop notifications for use with GMail and Google Calendar, 3. i wanted to see Chrome's 'Task Manager' feature

GPUM looks interesting .. I might give it a go
make that three reasons! :-$
> I'm guessing it is not the only cause but if browsers are to become the
> place to run apps in there should be a way to communicate with the user
> through the myriads of tabs they have open. I believe webkit notifications
> to be the right way to do that and I strongly believe that it should work
> across browsers.

I also think the same, but it is not a thing that would drift me towards webkit.

> Are these visible on top of all open apps?

Yes, even if you are watching a movie in KM Player or any other, "Nightly Update is available" dialog box in the bottom right corner appears on top of it. (at least on windows)
This is a huge feature. Desktop notifications have become a key part of my daily routine. I use Twitter exclusively through Tweetdeck for Chrome (with very heavy use of notifications). I use gmail/gapps for email also with heavy use of desktop notifications. I also keep Outlook open with the OWA Chrome Companion extension to give me Outlook popup alerts in Linux.

Chrome has truly achieved the "Web OS" function for me. I'm not sure it would be possible without desktop notifications. Their implementation may be less-than-perfect, but it's there.
I'd like the second the notion that these notifications - even if ugly and even if they have an unfortunate API - are really game changers in terms of browser usage.  Another example I use is in an online music player; that can pop-up notification about the current song playing.

The point is, long-running applications without this feature must either be entirely passive, or require the user the splinter his attention amongst everything running and regularly check each tab manually to look for updates (which is impractical even for just two running applications, let along more).

So in reply to comment #12, I could well imagine this to become a critical feature affecting browser choice.  It's not that widely used *yet*, as far as I can tell, so it's not likely to be critical for most users yet, but that might just be a matter of time.
I agree with the comments above.

While I normally use Firefox, sometimes I keep a Chrome window with Gmail open *only* to have this feature (for new mail and chat notification -- for example I can immediately see the chat message without needing to switch windows).  There are some extensions for Firefox, but none is as convenient as Chrome's implementation of this feature.

I do not mean to "spam" the bug, but I think it's important to show that there is a very real demand for this feature, and also that it's not an isolated case that someone would feel compelled to switch to Chrome just for this.  (I didn't switch to Chrome, but as I said, I often use Gmail in Chrome just for this)
May I know how's the status of this implementation?
Target to release at which version?
This is currently assigned to nobody, so no eta, and noone is working on it.
I also want to support the case that there is demand for this feature.  
I was temporarily using a replacement laptop and using Firefox on it was problematic at the time so I used Chrome and really got to digging the automatic mail notifications.

But I also wanted to point out the new Push Notification service being developed with a goal for standardization:
http://jbalogh.me/2012/01/30/push-notifications/
https://wiki.mozilla.org/Services/Notifications

Unfortunately its adoption and standardization (along with the timeline of each) are not yet sure things.
If Mozilla/Firefox is going in this direction, how will that affect this feature request?
If this push approach gains some traction will we consider the current w3c notification spec to be out in the cold (not worth developing) and expect Google and others to implement the new protocol?  Or is there room for both?
Inquiring minds want to know.
Push notifications will be much more useful if they can rely on something like desktop notifications, so I would consider the latter kind of blocking.
I added an emulation of chrome desktop notifications in my extension
https://addons.mozilla.org/addon/tab-notifier/
When it will be finally reviewed, credit will be given to Cyril Pascal, author of the previously mentioned extension, from which I stole ideas and some code, but, what I wanted to do was a prototype of what I think should be built in Firefox/SeaMonkey. In fact I think the approach of Chrome is fine, excluding html notifications, as only small and non intrusive notifications should be allowed, and the extension supports only simple notification.
Wow still "Assigned To: Nobody" after all this time?  :-(
Ben, totally not helpful.  Please read bugzilla etiquette rules:

  https://bugzilla.mozilla.org/page.cgi?id=etiquette.html
I apologise. I love Firefox (and have used it since it was 'Firebird') but I really hate having to have Chrome open at the same time in order to use Google Mail and Calendar effectively. I know that there are a few add-ons that add Desktop Notification support to Firefox but I find them to be rather clunky and a bit buggy.
I still believe this is a really important feature, just saw the Chrome 22 integration of video input and you know what they do when a webpage accesses the camera? They show a desktop notification telling me what app is now using the cam, priceless for someone who's a privacy aware, not sure how firefox will be able to replicate such a notification.
(In reply to jelveh from comment #29)
> I still believe this is a really important feature, just saw the Chrome 22
> integration of video input and you know what they do when a webpage accesses
> the camera? They show a desktop notification telling me what app is now
> using the cam, priceless for someone who's a privacy aware, not sure how
> firefox will be able to replicate such a notification.

That's a very different feature, since the notification is shown by the privileged code, not by the web pages. Firefox will have something similar (only better :) )

To come back to the desktop notification API, isn't wchen working on that? (ping dougt !)
(In reply to Ben Kennish from comment #28)
> I know that there are a few add-ons
> that add Desktop Notification support to Firefox but I find them to be
> rather clunky and a bit buggy.

You may consider to file one or more bugs for such extensions
Blocks: 774082
I'm willing to take this bug, if no one else is working on it. Maybe I'll need some directions.
(In reply to Marco Castelluccio from comment #32)
> I'm willing to take this bug, if no one else is working on it. Maybe I'll
> need some directions.

Thanks for taking it (or trying to take it ;) )

Maybe the implementation can be taken off from this addon https://addons.mozilla.org/en-US/firefox/addon/html-notifications

I have not exactly looked into its code, so maybe.
I actually have this implemeneted. There are just a few minor details left. Sorry, I should have taken this bug earlier.
Assignee: nobody → wchen
wchen: thank you - this is amazing! looking forward to testing it.
Depends on: 763643
bug 781061 is likely to happens on desktop too
Depends on: 782211
I am happy to see this feature implemented.
From my experience, webkit notifications are very, very useful feature. 
I implemented them in one of the apps used by traders on bank's trading floor and they love it. 
They don't need to monitor application any more (together with other 20+ apps running on 3 or 4 monitors). If apps needs their attention - it will notify them.
I have the problem that desktop notifications through helper addons html5 notifications or tab notifier don't appear when another app is in fullscreen. 
I've wrongly reported this before here:
http://code.google.com/p/ff-html5notifications/issues/detail?can=2&id=54

You may ask why this is relevant. 
We are using HTML5 desktop notifications in our classes where students can directly ask professors during the lectures and the question appears in front of the fullscreen presentation.
William - what's the status / current work around this? My interest is that the Add-on SDK has a notifications api that should benefit or at least not hinder this work.
Flags: needinfo?(wchen)
Lately I could see the Download Complete notification in a totally new style. I thought that this bug already got fixed :)
(In reply to Jeff Griffiths (:canuckistani) from comment #39)
> William - what's the status / current work around this? My interest is that
> the Add-on SDK has a notifications api that should benefit or at least not
> hinder this work.

The work is happening in bug 782211. All the patches to implement the feature are in the bug but some patches will probably need a few more rounds of review. With regard to the SDK notifications, it does not benefit nor hinder the implementation of w3c notifications.
Flags: needinfo?(wchen)
(In reply to William Chen [:wchen] from comment #41)
> With regard to the SDK notifications, it does not benefit nor
> hinder the implementation of w3c notifications.

Sure, but I need to evaluate how best to expose the new notification capabilities to add-on developers. The current SDK notification system relies on OS-level notifications, and has had poor adoption because most Macs aren't running 10.8 yet. I'd like a richer high-level api that add-on devs can use to notify users based on this work. Or maybe I'm missing something?

Thanks to for the pointer to the other bug ( sorry if I missed an earlier reference ). Looking forward to this landing.
Is there any progress being made on this feature? Cheers, Ben
Freedcamp http://freedcamp.com/ promotes use of Chrome because of its desktop notification feature (in the video). I'm afraid this kind of small feature might drive people away from Firefox.
I am one of those users -- desktop notifications are a really important feature for me.  I happen to keep my GMail in a pinned tab in the browser, and the only reason Firefox isn't my primary browser is that Chrome gives me desktop notifications.  For this use case, the notifications make it so that I don't need to manually check that tab incessantly for email updates.

I tried a handful of plugins to provide this feature, but I've never been satisfied with them for one reason or another [there is one that almost met my needs, but turned out to be broken after a FF update, finding it throwing error alerts on every notification, totally ruining it].

Plus, as a software developer getting into creating web applications, the ability to give notifications is a very useful feature, and I look forward to using the notification API in my own work.  Once features like that are in use, one begins recommending that users change browsers to ensure the best experience.
Please keep this a technical discussion.  If you want to discuss if/when we should land this feature, please use the mailing lists.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → DUPLICATE
Does this mean that they have now been implemented?  In Aurora?  I'd like to know as I'd like to give them a try.  Cheers.
(In reply to Ben Kennish from comment #48)
> Does this mean that they have now been implemented?  In Aurora?  I'd like to
> know as I'd like to give them a try.  Cheers.

Not in Aurora, but you can see them in latest nightlies.
Great. Thank you, Girish. :)
Anything needs to be enabled in order the get webkit notification to work in the latest nightlies?

http://sandbox.gtaero.net/chrome/notifications.php
doesn't work here with 22.0a1 (2013-03-22). 

Thanks
That page uses webkit specific code, so that can't ever work in any other browser than webkit.
Oh, thanks for the clarification. 
Are there any examples available demonstrating the usage?
For everyone who wants to try the feature out, grab a copy of latest Nightly and go to this page :
http://jsbin.com/notification/1/edit

Please note that what is offered by Gmail is WebkitNotofication() that is webkit's own implementation as per the W3C spec. Since the name of the function is different, thus it will be some time until GMail gets to know that Firefox also supports Notifications (They will have to update their code.)

As the number of people CC'ed on this bug is huge, please try to refrain from further discussion on this bug :)
Web notifications have now been implemented in Aurora (v22.0a2). I have modified the above JSbin test page to include an icon in the notification and an alert when the notification closes. You can find it here:

http://jsbin.com/notification/571/edit
Nice feature! But I noticed some not-really-smart behaviors on XFCE : 

+ The system skin is not applied.
+ The notification only appears on the primary screen (On a dual screen desktop computer). With xfce4-notifyd the notification is displayed on the screen where the mouse pointer is (I don't know for Gnome, windows or others sorry).
+ I found no preference to choose where I want it to display (top-right/left/middle, bottom-right/left/middle, margins?...) so it hides my taskbar.

Anyway, thanks for this feature!
@ben - nice! thank you.


@Jean - I think these are deficiencies with the dialogs in Gecko that we are using, not with web notifications per se.  Do you notice these same things when Firefox prompts you to update?
Update notifications are good as in Thunderbird when I get new mail.
A question: if i choose to always enable the notification for some sites, how can i re-disable them through some manage ui?
(In reply to ayanamist from comment #59)
> A question: if i choose to always enable the notification for some sites,
> how can i re-disable them through some manage ui?

Go to the site, Right click anywhere, View page info > Permissions tab > Show notifications.
or
Click the icon before the url in the location bar, click more info, permissions tab, show notifications
The Notifications are cool but they are not nice enough. They are a bit ugly and little customizable, it should be something like what Google has made in Chrome 28.

Greetings.
(In reply to alfonso.cama from comment #61)
> The Notifications are cool but they are not nice enough. They are a bit ugly
> and little customizable, it should be something like what Google has made in
> Chrome 28.
> 
> Greetings.
+1
(In reply to alfonso.cama from comment #61)
> The Notifications are cool but they are not nice enough. They are a bit ugly
> and little customizable, it should be something like what Google has made in
> Chrome 28.
> 
> Greetings.

Can you file a new bug with some recommendations for improving the visual design of the notifications on your platform?

This bug is long ago closed.
Can permissions for this feature be handled globally?  I checked the about:permissions All Sites sections, but do not see an option for Desktop Notifications.

I am trying to set the base state of the browser prior programmatically prior to running automation tests.  As far as I can tell the only way to prevent the alert dialog that request permissions for displaying desktop notifications is to directly update the permissions.sqlite with each site that is allowed.  Is this not something that can be accomplished via a user_pref?
You need to log in before you can comment on or make changes to this bug.