Skip to content Skip to sidebar Skip to footer

Prompt In Windows Phone

I'm implementing an app using JavaScript and I have a problem with the command 'Prompt'. In Android it works fine but in Windows Phone 8 it doesn't work at all. Example: var per

Solution 1:

Internet Explorer blocks the prompt method in IE7+ for security reasons. You will have to roll your own instead.


Solution 2:

For this kind of purposes there is a notification plugin in phonegap which also can be used as prompt

http://cordova.apache.org/docs/en/3.3.0/cordova_notification_notification.md.html#notification.alert

// Amazon Fire OS / Android / BlackBerry 10 (OS 5.0 and higher) / iOS / Tizen
//
function alertDismissed() {
    // do something
}

navigator.notification.alert(
    'You are the winner!',  // message
    alertDismissed,         // callback
    'Game Over',            // title
    'Done'                  // buttonName
);

Don't forget to see the quirk section to get it work in windows phone

Windows Phone 7 and 8 Quirks

There is no built-in browser alert, but you can bind one as follows to call alert() in the global scope:

window.alert = navigator.notification.alert;

Both alert and confirm are non-blocking calls, results of which are only available asynchronously.


Post a Comment for "Prompt In Windows Phone"