How do you keep an iPhone/iPad web app in full screen mode? How do you keep an iPhone/iPad web app in full screen mode? ios ios

How do you keep an iPhone/iPad web app in full screen mode?


Let the computer do the tedious job, that's what they're made for.

This is a piece of javascript code I use to avoid rewriting all my links. With that, only those links that have an explicit target = "_blank" attribute will open in Safari. All other links will remain inside the web app.

var a=document.getElementsByTagName("a");for(var i=0;i<a.length;i++) {    if(!a[i].onclick && a[i].getAttribute("target") != "_blank") {        a[i].onclick=function() {                window.location=this.getAttribute("href");                return false;         }    }}


Heres a jQuery plugin that could help: https://github.com/mrmoses/jQuery.stayInWebApp

Its a similar javascript solution, but has a few more features. By default it will attach to all links, but you can use it to attach to links with a certain class or something. It also detects iOS full screen mode so that it doesnt get in the way of other browsers and devices.


In my experience, any external link seems to cause the app to jump out of full-screen mode. One solution is to manage your navigation using javascript and the location object. As follows:

HTML:

<a href="javascript:navigator_Go('abc.aspx');">Go</a> 

Javascript:

function navigator_Go(url) {    window.location.assign(url); // This technique is almost exactly the same as a full <a> page refresh, but it prevents Mobile Safari from jumping out of full-screen mode}

I know it's a pain to have to rework your links in this way, but it is the only way I have found to solve the problem you are facing.