Share via


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!!!

Comments

  • Anonymous
    February 04, 2014
    With the major difference that it won't block as alert() does...

  • Anonymous
    November 18, 2014
    The comment has been removed

  • Anonymous
    August 29, 2016
    me funciono vato crero que voy a hacer apps para windows 10 :) y la plata