Skip to content

Windows 8 JavaScript Notification Toast

I’m working my way through a set of topics for Windows 8 application development with HTML and JavaScript and I decided that I wanted to display Toast notifications for some things – basically I wanted to let the user know that their settings were saved. Ultimately I’ll pull these but for now they’re also useful for me for debugging to know that my background threads completed successfully without having to set a breakpoint. There are two key pieces to this process. First, the application needs to support notifications and that’s in the package.appxmanifest on the Application UI tab:

You’ll see a section for notifications – and an option to do Toast capable. Then you need some code to show a toast message. Here’s something straightforward that you can adapt to suit your needs:

function sendLocalNotification(message) {

var template = Windows.UI.Notifications.ToastTemplateType.toastText01;

var contentXml = Windows.UI.Notifications.ToastNotificationManager.getTemplateContent(template);

var toastTextElements = contentXml.getElementsByTagName("text");


var toast = new Windows.UI.Notifications.ToastNotification(contentXml);

var toastNotifier = Windows.UI.Notifications.ToastNotificationManager.createToastNotifier();;


Happy toasting.

No comment yet, add your voice below!

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share this: