This is a mirror of official site: http://jasper-net.blogspot.com/

Using Overlay Icon API to Make Client Notifications in IE9

| Tuesday, October 12, 2010
Ever wanted to notify your site clients/users while they are surfing in your site. In one of the applications that I helped to build this was a customer requirement. So in the past you could have implemented a blinking behavior that will make the icon of the browser blinking. Not a very user friendly behavior for my taste. With IE9 you now able to use the new SiteMode Overlay Icon javascript behavior which is part of the site pinning feature.

Overlay Icon API

The Overlay Icon API include two simple methods:

msSiteModeSetIconOverlay – the method enables to communicate alerts, notifications and statuses to the site users by adding an icon on top of the the existing web site icon. The method takes two parameters – an image url and a tooltip value.
msSiteModeClearIconOverlay – the method clears any existing overlay icon.
Pay attention that this behavior will only work in a pinned site so check whether the site is in SiteMode before using these methods.

Overlay Icon In Action

When the following page is loaded in a pinned site the result will be an overlay icon on top of the pinned site icon:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
   <title>My application</title>
   <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
   <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
   <meta name="application-name" content="My Application" />
   <meta name="msapplication-tooltip" content="My Application" />
   <meta name="msapplication-starturl" content="./" />
   <meta name="msapplication-task" content="name=My Blog;action-uri=http://blogs.microsoft.co.il/blogs/gilf;icon-uri=/favicon.ico" />
   <meta name="msapplication-task" content="name=My Linkedin Profile;action-uri=http://il.linkedin.com/in/gilfink;icon-uri=http://www.linkedin.com/favicon.ico" />
   <script type="text/javascript">
       window.external.msSiteModeSetIconOverlay('/info.ico', 'Attention Needed');
   </script>
</head>
<body>


Read more: Gil Fink on .Net

Posted via email from .NET Info

0 comments: