简体   繁体   English

如何在jQuery Mobile中单击按钮关闭应用程序

[英]how to close the application on button click in jquery mobile

i am developing jquery mobile app for IOS and Android, I wanted to close the Entire Application on button click using below function still but it's not closing the APP 我正在为IOS和Android开发jquery移动应用程序,我仍然想使用下面的功能在单击按钮时关闭整个应用程序,但它没有关闭该应用程序

            if (navigator.app) {
                        navigator.app.exitApp();
                    }
                    else if (navigator.device) {
                        navigator.device.exitApp();

                    }

You can use navigator.app.exitApp() - I believe that's supported on Android. 您可以使用navigator.app.exitApp() -我相信Android上支持该功能。 create on click function and call it on that button event 创建点击功能并在该按钮事件上调用它

function ExitApp()
{
navigator.app.exitApp();
}

On iOS, Apple does not allow apps to programmatically exit. 在iOS上,Apple不允许应用程序以编程方式退出。

but for ios you can try, in the application's plist put 但对于ios,您可以尝试在应用程序的plist中

 UIApplicationExitsOnSuspend = TRUE

and when the user hits the home button, the application will quit. 当用户点击主页按钮时,该应用程序将退出。 No need for a button, no need for exit(). 不需要按钮,不需要exit()。

http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW23 http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/doc/uid/TP40009252-SW23

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM