Created
August 30, 2012 21:43
-
-
Save shazron/3541951 to your computer and use it in GitHub Desktop.
Test case for https://issues.apache.org/jira/browse/CB-1288
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
| <meta name="format-detection" content="telephone=no" /> | |
| <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width;" /> | |
| <title>Hello World</title> | |
| <script type="text/javascript" src="cordova-2.1.0rc1.js"></script> | |
| <script type="text/javascript"> | |
| document.addEventListener("deviceready", onDeviceReady, true); | |
| var watchID; | |
| function onDeviceReady() { | |
| watchID = navigator.geolocation.watchPosition(onSuccess, onError, { timeout: 30000 }); | |
| } | |
| function onSuccess(position) { | |
| try { | |
| var element = document.getElementById('result'); | |
| element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' + | |
| 'Longitude: ' + position.coords.longitude + '<br />' + | |
| 'Timestamp: ' + position.timestamp.getTime() + '<br />' + | |
| '<hr />' + element.innerHTML; | |
| } catch (e) { | |
| alert(e); | |
| } | |
| } | |
| // onError Callback receives a PositionError object | |
| // | |
| function onError(error) { | |
| alert('code: ' + error.code + '\n' + | |
| 'message: ' + error.message + '\n'); | |
| } | |
| </script> | |
| </head> | |
| <body> | |
| <div id="result"></div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment