Javascript Alert pop up not working in windows phone 7 for phonegap

1,860 views
Skip to first unread message

viji

unread,
Dec 8, 2011, 7:40:10 AM12/8/11
to phonegap
I have the following code which is not working on my emulator

// once the device ready event fires, you can safely do your thing! -
jm
function onDeviceReady()
{
document.getElementById("welcomeMsg").innerHTML += "PhoneGap is
ready! version=" + window.device.phonegap;

alert('hi');
}

Since phonegap uses lot of JavaScript for functioning, I wonder why
this alert is not popping up.
The alert does not even pop up outside onDeviceReady()


Any pointers to solve this would be great.
Thanks in advance.

Jesse MacFadyen

unread,
Dec 8, 2011, 4:12:56 PM12/8/11
to phon...@googlegroups.com
WP7 IE9 WebBrowser component does not support alert.
Use navigator.notification.alert("Hi");

Or, if you must :

window.alert = navigator.notification.alert;

Note that the PhoneGap alert api has additional params as defined here:
http://docs.phonegap.com/en/1.2.0/phonegap_notification_notification.md.htm
l#notification.alert

Cheers,
Jesse

Jesse MacFadyen
{
blog:'r <http://blogs.nitobi.com/jesse>isingj.com',
email:'jes...@adobe.com',
company:
{
name:'Adobe Systems Incorporated
',
site:'www.adobe.com <http://www.nitobi.com/>',
phone:
{
office:'+1 (604) 685-9287 <tel:%2B1%20%28604%29%20685-9287>',
tollFree:'1-866-632-2777 <tel:1-866-632-2777>'
}
}
}

>--
>You received this message because you are subscribed to the Google
>Groups "phonegap" group.
>To post to this group, send email to phon...@googlegroups.com
>To unsubscribe from this group, send email to
>phonegap+u...@googlegroups.com
>For more options, visit this group at
>http://groups.google.com/group/phonegap?hl=en?hl=en
>
>For more info on PhoneGap or to download the code go to www.phonegap.com

Oliver Gray

unread,
Sep 10, 2013, 10:24:52 PM9/10/13
to phon...@googlegroups.com
Hi Jesse,

This functionality doesn't seem to be available in the latest WP7 visual studio template, the navigator object does not have a notification property, see this post for additional details; http://stackoverflow.com/questions/18042909/phonegap-build-navigator-notification-alert-not-working-in-wp7-emulator/18731585#18731585

Please let me know if I can raise this somewhere more appropriate, otherwise I will dig deeper when I have some more time :)

Thanks.

Oli Gray
Reply all
Reply to author
Forward
0 new messages