我正在开发感应器触摸应用程序,我的观点不是在安卓设备5.1.1上使用安卓系统WebView 46.0版本,而是在WebView的下面版本中很好地工作。
发布于 2015-11-30 07:10:53
在index.html中添加以下脚本
<script type="text/javascript" charset="utf-8">
var mobile = false;
if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)) {
document.addEventListener("deviceready", function(){mobile = true; onDeviceReady();}, false);
} else {
$(document).ready(onDeviceReady);
}
function onDeviceReady() {
setEvents();
test();
if (mobile) {
navigator.notification.alert("Debugging-ready for\n" + navigator.userAgent);
} else {
alert("Debugging-ready for\n" + navigator.userAgent);
}
};
</script>现在,您可以在onDeviceReady()方法中做您想做的任何事情。如果有帮助请告诉我。
https://stackoverflow.com/questions/33914400
复制相似问题