Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
- <html>
- <head>
- <title>Cordova Menu Button Example</title>
- <script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script>
- <script type="text/javascript" charset="utf-8">
- // Call onDeviceReady when Cordova is loaded.
- //
- // At this point, the document has loaded but cordova-1.7.0.js has not.
- // When Cordova is loaded and talking with the native device,
- // it will call the event `deviceready`.
- //
- function onLoad() {
- document.addEventListener("deviceready", onDeviceReady, false);
- }
- // Cordova is loaded and it is now safe to make calls Cordova methods
- //
- function onDeviceReady() {
- // Register the event listener
- document.addEventListener("menubutton", onMenuKeyDown, false);
- document.addEventListener("volumedownbutton", onVolumeDownKeyDown, false);
- document.write("<h>ondeviceready</h1>");
- }
- // Handle the menu button
- //
- function onMenuKeyDown() {
- document.write("<h1>Menu</h1>");
- }
- function onVolumeDownKeyDown() {
- document.write("<h1>volume</h1>");
- }
- </script>
- </head>
- <body onload="onLoad()">
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement