Skip to content

Instantly share code, notes, and snippets.

@dongyuwei
Created December 16, 2011 09:41
Show Gist options
  • Save dongyuwei/1485360 to your computer and use it in GitHub Desktop.
Save dongyuwei/1485360 to your computer and use it in GitHub Desktop.
解决jquerymobile用phonegap打包后后退导航失效问题
document.addEventListener("deviceready", function(){
var initUrl = location.href;
if (Device.platform === 'Android') {
//阻止按后退按钮就退出程序
navigator.app.overrideBackbutton(true);
}
/*解决jquerymobile用phonegap打包后后退导航失效问题*/
document.addEventListener("backbutton", function(){
//alert(location.href);
if(location.href === initUrl){
return navigator.app.exitApp();
}
return history.back();//这样会导致程序不能按android常规那样正常退出
}, false);
}, false);
@dongyuwei
Copy link
Author

<style>
   /*解决jquerymobile渲染时页面闪烁问题*/
   .ui-page { 
      -webkit-backface-visibility: hidden;
   } 
</style>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment