Get users' attention when browser is minimized (cross-browser desktop notifications?)

淺唱寂寞╮ 提交于 2019-12-09 12:24:23

问题


I'm working on a browser-based application that needs to be able to get users' attention when the user receives an incoming event, such as a message, even if the user has minimized the browser.

Searching gave me some good results, but nothing cross-browser or firefox-specific. I need to be able to support IE 7+ and FF 3.6+ (specific to the user base).

Here are the things I've looked at:

  • Are there any JavaScript library for cross browser desktop notification?
  • Make browser window blink in task Bar

So far, we used a simple javascript alert to get the tray icon to flash, but that created an extra click in trying to respond to the notification (total of 3 clicks now, or a 33% degradation). Users are expected to do this 20-50 times a day, so it will get really annoying really quickly.

Based on an example provided on Microsoft developers network, I made this simple prototype that worked well for IE, but it's IE-specific and will not work in other browsers:

<HTML>
<HEAD>
<TITLE>Popup Example</TITLE>
<SCRIPT LANGUAGE="JScript">
function timeMsg()
{
    var t=setTimeout("ButtonClick()",5000);
}

var oPopup = window.createPopup();

function ButtonClick()
{
    var oPopBody = oPopup.document.body;
    var myHeight = (window.screen.availHeight - 125);
    var myWidth = (window.screen.availWidth - 350);

    oPopBody.style.backgroundColor = "red";
    oPopBody.style.border = "solid black 1px";
    oPopBody.innerHTML = "Click outside <B>popup</B> to close.";
    oPopup.show(myWidth, myHeight, 300, 75);
}
</SCRIPT>
</HEAD>
<BODY>
<BUTTON onclick="timeMsg()">Display alert in 5 seconds</BUTTON>
</BODY>
</HTML>

Any suggestions on how to make this experience better without using an executable installed locally are greatly appreciated!


回答1:


We ended up just going with Google Chrome Desktop Notifications and asking our clients to either user Chrome or Chrome Frame within IE. Notifications are augmented by playing a sound as an alert.

Here's the documentation on it: http://code.google.com/chrome/extensions/notifications.html




回答2:


As old as it is: Here is some new stuff might solve the problem in ~> IE9

Use window.extern.msSiteModeSetIconOverlay api call.

Here is a reference

http://www.codeproject.com/Articles/117115/Using-Overlay-Icon-API-to-Make-Client-Notification




回答3:


If you can dictate that the users will turn off popup blockers, then have a "setup" page.

That page has instructions on how to turn off popup blockers for you site and their/all browsers. Preferably with images showing what to do. Most browsers give a notice that a popup has been suppressed with a way of adding the site to a "white list".

Then initiate a popup on that page when they click a button or perform some other action. Then they can just follow the instructions and turn off the popup suppression.



来源:https://stackoverflow.com/questions/7855568/get-users-attention-when-browser-is-minimized-cross-browser-desktop-notificati

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!