我使用Windows移动应用程序(phonegap)的以下功能来处理后退导航功能 .
function onBackKeyDown() {
var currentPageId = $.mobile.activePage.attr('id');
if(currentPageId == 'contact-us' || currentPageId == 'about-us' || currentPageId == 'location-map' || currentPageId == 'services'){
$.mobile.changePage("index.html", {
transition : "slide",
reverse : true,
changeHash : false
});
}else{
navigator.app.exitApp();
}
}
如果当前页面不是索引,我想来索引 . 否则退出应用程序 . 似乎navigator.app.exitApp()在Windows Phone 7中不起作用 . 有没有解决此问题的解决方案 .
1 回答
这个插件对我来说很方便 .
http://shinymetilda.github.io/Cordova_Exit_Plugin/
将.cs文件添加到插件目录中 .
将以下代码添加到config.xml
编写此代码而不是navigator.app.exitApp()