I am trying to use the menu button on Android using PhoneGap. The problem is that I cannot use it because this error occurs in the log:
"Unprepared ReferenceError: cordova undefined."
This is the source:
<!DOCTYPE html> <html> <head> <script type="text/javascript" charset="utf-8" src="cordova.js"></script> <script type="text/javascript"> function onLoad() { document.addEventListener("deviceready", function () { document.addEventListener("menubutton", function(){ alert('Menu button pressed.'); }, true); }, false); } </script> </head> <body onload="onLoad()"> <p>Hello world!</p> </body> </html>
I thought the problem was with importing cordova.js, so I tried using all of these parameters that were commented out.
I don’t know if there is any relation, but all the time when I run the script this error appears in the console with red color:
E/webview(21743): registerForStylusPenEvent onAttachedToWindow E/webview(21743): registerForStylusPenEvent START E/webview(21743): registerForStylusPenEvent END
Sorry if you had an English error, but I'm trying to do this without Google Translator.
Thanks.
Diego dutra
source share