How to code quit command

Hi, everyone, does anyone knows how to code ‘quit app’? Sometimes, just lazy to press the quit icon. Would it be nice to quit inside your/mine app. I am all ears… Morning greetings, tst

Is this running on a mobile device?

Yes;can I have the code that. 1.quit and stays in ram, 2.quit and stay out of ram. Thanks in advance, tst

Forget to mention, android phone. If u would like for the benefit of iPhone coder, u might write it down 4 them too.

Have a look at a few Android apps. Do any of them have quit buttons? It’s not normal to have them.

I think if you try to put a quit button on an iOS app, it will be rejected by Apple.

OK, thank you for your immediate response…

Even as a web app, there’s no real way to do it. And as @ghenne has noted, you don’t see quit buttons in apps. Here’s how the browser security restrictions affect web apps:

From the latest working spec for window.close() :

The close() method on Window objects should, if all the following conditions are met, close the browsing context A :

  • The corresponding browsing context A is script-closable .
  • The browsing context of the incumbent script is familiar with the browsing context A .
  • The browsing context of the incumbent script is allowed to navigate the browsing context A .

A browsing context is script-closable if it is an auxiliary browsing context that was created by a script (as opposed to by an action of the user), or if it is a browsing context whose session history contains only one Document.

This means, with one small exception, javascript must not be allowed to close a window that was not opened by that same javascript.

As noted somewhere on this discussion board, there are some plugins that you can force to fail and they crash your app completely - basically doing a force stop. But this doesn’t sound like a good design technique.