views:

1186

answers:

3

In the iPhone is there a way I can use JavaScript to close the browser and return to the home screen? After the last page a wizard I am calling out to another iPhone app (ex: maps) and I do NOT what the user to come back to the browser screen when they are done. My backup plan is to have a "Complete" page but that is not the best experience for the client.

A: 

Knowing Apple, this may not be possible with JavaScript. Have you tried anything yet? If not, try one of these guys out:

javascript:self.close();
window.close();

EDIT: I found this thru google, this may bypass the confirmation box, but I don't think it works with the modern browsers anymore:

window.opener='x';
window.close();

I just checked, doesn't look like it will work (IE7 box pops up, FF3 does nothing, Opera 9.61 doesnt have a prompt box at all).

Anders
A: 

Expanding on Anders: window.close() will do what you want. According to the Window doc page, if you try and close an window not opened via javascript, the user will be prompted to confirm.

sblundy
A: 

I have confirmed with apple this is not possible in iPhone OS 2.2 and before.

I have tried each of these good suggestions but, they will not close the browser on the iPhone.

Jamey McElveen