Closed Bug 293412 Opened 19 years ago Closed 12 years ago

Firefox should expose a browser notification API

Categories

(Core :: General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 594543

People

(Reporter: jdperlow, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
Build Identifier: 

Some unpriviliged browser applications need the ability to notify the user when
an interesting event has occurred. IE exposes window.createPopup(), which allows
the developer to create a chromeless popup window that hosts HTML. This can be
used to implement a notification that pops up near the system taskbar. Firefox
could implement a similar mechanism.

Alternatively, Firefox has a notification service that shows "toast" in the
bottom righthand side of the desktop to notify the user of an event. The file
download sevice uses this to notify the user when a download has completed. If
Firefox exposed this to unpriviliged browser applications, that would provide a
great way to fix this problem for developers.





Reproducible: Always
Status: UNCONFIRMED → NEW
Ever confirmed: true
This functionality would be very valuable for a new product I am developing. The
app will have a lot of usage, and we're hoping that the Firefox experience will
be at least as good as the IE experience. Any chance of improving this for 1.1?
Flags: blocking-aviary1.1+
Set as requesting blocking-aviary1.1 on behalf of kcoleman. (Please do not
misuse the blocking flags).
Flags: blocking-aviary1.1+ → blocking-aviary1.1?
Not on radar for 1.1, should be a core bug, not specific to Firefox.

Exposing things like the alert service is dubious, since that means random sites
can abuse it as well, so signing your web app makes a lot more sense to access
these abilities.
Flags: blocking-aviary1.1? → blocking-aviary1.1-
Except that the UI for granting permission to signed web apps is very poor.
Taking for preliminary investigation.
Assignee: nobody → pkasting
I could see adding an API like

   window.pageUser();

...with no arguments, with the browser then popping up some notification like "The site bugzilla.mozilla.org is requesting your attention.", and making the tab change colour, or something, but I can't see doing anything else (what I just described is basically what you can do today using window.alert(), but using slightly saner, non-modal UI). Any sort of API that provides a string, as in:

   window.notify("You have new mail!");

...will be abused to hell and back.

   setInterval(function(), {
     window.notify("Buy our widgets! Only $2.99 if you click now.");
   }, 10000);

If you think window.pageUser() is a good idea (maybe with a better name) then let me know (or mail the whatwg@whatwg.org mailing list) and I can add that feature to the spec quite easily.
Maybe window.getAttention() like XUL windows have?
getAttention() is indeed a better name.
I have mentioned this in various conversations before, but I think it might be worthwhile to allow a string in some API call which is controlled under the popups whitelist.

In other words, almost no sites would be able to use it, but if some site did something really compelling they could ask their users to allow it (just like some sites currently ask people to allow popups).

I haven't thought this through well.  It's not clear to me whether there would need to be a separate pref for this (bad) or if it could just be controlled by the exact same UI the popup whitelist is (i.e. adding a site there allows it to use this API); and how such an API would look (for example, we could allow getAttention() to take a string, but only pop up the notification with the string if we're whitelisted; otherwise just do the "normal" stringless notification).
Having the whitelist like Peter suggests would be great. If it was a whitelist, it would be ideal to have the application be able to create a chromeless window that it could just animate on and off-screen. This would allow Gmail chat to create very good notifications for incoming instant messages like Google Talk does (but without requiring a native code install).
Perhaps we could consider implementing createPopup() to do what IE does, and put it under direct control of the popup blocking/whitelisting stuff.  That seems like a consistent and non-hacky implementation here.

I like the "toast" notification system quite a bit as a user, but I'm not sure how to expose an API to it.  It's not quite the same as a "popup" so maybe users would be confused as to why sites' uses of it were controlled by the popup prefs.

getAttention() may be doable as well.

It's not clear to me whether we should have one, two, or three separate systems here, and how all these should interact.  Web developers or folks with a lot of experience in this area should probably chime in here.  If I had to take a stab at it right now, I'd say to do two things:
(1) Implement createPopup() like IE and put it under the popup controls, so for most users on most sites it'll do nothing, but for specific sites users can allow the browser to give them information.
(2) Implement getAttention(), taking a look at the XUL windows' implementation, and make it do something sane but non-abusable (i.e. no strings), and allow it to be always on.  Consider providing a pref to turn this off?
These questions are beyond my ability to properly address.  Dumping back to nobody to make it clear I'm not coming up with an answer.
Assignee: pkasting → nobody
This is a Core bug, I don't know why it's in Firefox, it's a web content RFE.
Product: Firefox → Core
QA Contact: general → general
I think was in Firefox because "expose the function call to content" is the easier part of the bug; how it's implemented in Firefox the application is the more complex part of the bug, and determines much about how any lower layers should act or intervene.  Might be a toolkit thing, but I suspect that to do a good job with it you need a fair bit of application-specificity.
Blocks: 527846
Could be duped against the contemporary bug 594543?
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.