@Thomas,
It used to be that navigator.app.exitApp()there were only a few stumbling blocks in the call , but now both Google and Apple have posed serious obstacles for developers.
- ,
deviceready, . , () - , deviceready, . - * *.
whitelist, Android CSP. CSP. , Javascript ( on*=) <style> ( style=) . CSP – -.
. # 1,
javascript:
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
document.getElementById('exitApp').addEventListener('click', function() {
navigator.app.exitApp();
});
}
index.html:
<button id="exitApp">Exit</button>
# 2, :
config.xml
<plugin name="cordova-plugin-whitelist" source="npm" spec="1.1.0" />
<allow-navigation href="*" />
<allow-intent href="*" />
<access origin="*" />
. .
index.html
<meta http-equiv="Content-Security-Policy"
content="default-src *;
style-src * 'self' 'unsafe-inline' 'unsafe-eval';
script-src * 'self' 'unsafe-inline' 'unsafe-eval';">
. .
, .
: Cordova/Phonegap