title: How to close a iPad webapp and open safari?
body: <p>I'm working on a webapp for iPad. What I want is provide a "save &amp; quit" option. When the user presses the quit button, I safely update my database and show a screen who thanks the user for using the webapp.</p>
  
  <p>What I want to do now is actually close the webapp. As <code>window.close();</code> doesn't seems to work I have found a workaround with links.</p>
  
  <p>Clicking on a link in a webapp closes the fullscreen app and opens safari. So far I tried to embed an hidden link in my mage and trigger it with <code>link.onclick();</code> but it doesn't work, and <code>document.location=</code> doesn't open safari.</p>
  
  <p>Here's the HTML example:</p>
  
  <pre><code>&lt;body onload="leave();"&gt;
    Modifications saved, goodbye!
    &lt;a id="goodbye" href="www.mahsite.com" style="display:none;"&gt;&amp;nbsp;&lt;/a&gt;
  </code></pre>
  
  <p>And the JS:</p>
  
  <pre><code>function leave() {
              window.close();//Doesn't work
              window.setTimeout(function e(){document.getElementById('goodbye').onclick();},1000);
              return true;
          }
  </code></pre>
  
  <p>Can someone give me an idea? I'm aware that the <code>onclick()</code> won't work unless I have a onclick handler attached to my link, but I don't have any other idea.</p>