Wriju's BLOG

.NET, Cloud and everything

WinJS using alert() in your JavaScript

If you come from JavaScript world you will badly miss the alert() function. However, this habit can be entertained if you declare a function at default.js file. Then it will be accessible in all other pages which are navigated from default.html page.

function alert(message) {
    var msgBox = new Windows.UI.Popups.MessageDialog(message);
    msgBox.showAsync();
}

Then this code would work,

alert('Welcome back dear Alert');

Namoskar!!!