Flashing the Pinned Site Taskbar Button

This task shows you how to attract attention to your Pinned site by flashing the taskbar button.

Note  This feature is not available in Windows 8. For more information about notifications in Windows 8, see Pinned site notifications in Windows 8.

 

  • Methods Used in this Task
    • msSiteModeActivate()
  • To Flash or Not to Flash
  • Flashing the taskbar button
  • Related topics

Methods Used in this Task

The following method is introduced in this topic:

msSiteModeActivate()

The window.external.msSiteModeActivate method flashes (causes to blink) the Pinned site button on the taskbar. The button flashes 20 times, and then remains highlighted until the user clicks the button to bring the window to the foreground.

To Flash or Not to Flash

Occasionally, your application will need to notify users of some of the following important events:

  • Completion of long-running tasks
  • The session times out due to inactivity
  • A form requires additional input

Flashing the taskbar button is an easy way to get a user's attention. Be aware, however, that the more often you use the flash capability, the less likely it will be effective. Before you flash, consider whether using an icon overlay is more appropriate. The following guidelines can help you determine when to flash a taskbar button:

  • Flash only to demand immediate attention to keep an ongoing task running. Flashing indicates that user input is required before the application can continue its normal execution. Do not flash the taskbar button if the user need only read a message or see a change in status.
  • Use taskbar flashing sparingly. It is difficult for users to concentrate while a taskbar button is flashing, so assume that they will interrupt what they are doing to make it stop. Make sure the interruption is justified.
  • Do not flash to draw attention to an icon overlay. Let users discover overlay icons on their own.

Flashing the taskbar button

To flash the taskbar button, call the msSiteModeActivate method. Nothing will happen, however, if the window is already has focus. To see the flashing effect, you need to bring another to the foreground. To demonstrate the effect, the following script gives you two seconds to tab away from the window before it calls msSiteModeActivate. Your application is more likely to call this method in response to an event, such as receiving a message from the server.

function flashWindow()
{
    try {
        if (window.external.msIsSiteMode()) {
            alert('Tab away from this window.');
            window.setTimeout("window.external.msSiteModeActivate()", 2000);
        }
    }
    catch (ex) {
        // Fail silently.
    }
}
<button onclick="flashWindow()">Flash the taskbar button</button>

Tasks

Working with Custom Icon Overlays

Conceptual

How to Provide Notifications

Introduction to Pinned Sites