Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.3.0
-
None
-
None
Description
Good Day All,
I recently tested a code whereby I called navigator.notification.confirm on 2 pages.
On the first page, I create an instance that triggers a navigator.notification.confirm query, accepting should launch the next page which also has a navigator.notification.confirm triggered from onDeviceReady.
Once the second instance is triggered, app crashes and returns no error(or at least visible one).
I am testing this on Windows 8 pro, PhoneGap 3.3 and I have all plugins needed installed.
When I test this and have a button launch the same function on the second page, error doesn't occur.
Find below sample code for said issue:
Page 1:
<!DOCTYPE html>
<html>
<head>
<title>Notification Example</title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
//
function onDeviceReady()
// process the confirmation dialog result
function onConfirm(buttonIndex) {
//alert('You selected button ' + buttonIndex);
if(buttonIndex === 1)
}
// Show a custom confirmation dialog
//
function showConfirm() { navigator.notification.confirm( 'You are the winner!', // message onConfirm, // callback to invoke with index of button pressed 'Game Over', // title ['Restart','Exit'] // buttonLabels ); }
</script>
</head>
<body>
<p><a href="#" onclick="showConfirm(); return false;">Show Confirm</a></p>
</body>
</html>
Page 2:
<!DOCTYPE html>
<html>
<head>
<title>Notification Example</title>
<!-
<script type="text/javascript" charset="utf-8">
// Wait for device API libraries to load
//
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
//
function onDeviceReady() { // Empty showConfirm(); }
// process the confirmation dialog result
function onConfirm(buttonIndex) {
//alert('You selected button ' + buttonIndex);
if(buttonIndex === 1){ window.open("page2.html","_self"); }
}
// Show a custom confirmation dialog
//
function showConfirm()
</script>
</head>
<body>
<p><a href="#" onclick="showConfirm(); return false;">Show Confirm</a></p>
</body>
</html>
Thanks.
Ismael