The "add to home screen" shows up on all pages of a site, and I want the URL to be the homepage that gets saved.
For example on this page: http://www.domain.com/category/page.html
Is it possible for the "Add to home screen" to save this url: http://www.domain.com
Any help would be greatly appreciated.
To move it like you would any other app, tap and hold its icon, then tap Edit Home Screen, and you'll be able to drag it to your desired location. When you've placed it where you want it, tap Done.
Add a website icon to your Home ScreenYou can add a website icon to your iPhone Home Screen for quick access to that site. , then tap Add to Home Screen. The icon appears only on the device where you add it.
I found a sort-of workaround to this. You can detect that you were launched from the home page via window.navigator.standalone and based upon that potentially redirect.
Also, I have done a little testing and found that on the latest iOS, different user agents are reported to the server, which opens the possibility of a faster redirect. I can't find any information about whether this has always been the case.
Launch from home page:
Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Mobile/10A523
Mobile Safari:
Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A523 Safari/8536.25
If your page gets most of its content via AJAX or you notice the different user-agent on the server it might be possible to skip the redirect and just act "as if" you were at another URL, since in standalone mode the URL is invisible anyway. I'm investigating this but haven't got far enough to say whether it will burn you or not.
Also note that the user's choice of URL to mark as an app may be meaningful, but I'll leave that to your own UX judgment.
A combination of both WrightsCS and svachalek Answers - You can't add to home screen a remote page, however, you can redirect the page after it has been added to the home screen.
All you need to do is use this simple javaScript:
if ("standalone" in window.navigator && window.navigator.standalone){ //checks if you're in app mode window.location = 'http://www.domain.com'; //the URL you want to refer to. }
Make sure you add this html code to your page:
<meta name="apple-mobile-web-app-capable" content="yes">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With