6

When a user launches "new window" link in a home screen app.

In Mobile Safari this type of action would open a new tab. What happens if the app is on the home screen and has name="apple-mobile-web-app-capable", content="yes" active.

Will the window still technically be in another tab, although you cant get back to the original one - or will it just navigate within the current tab?

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
fancy
  • 48,619
  • 62
  • 153
  • 231

2 Answers2

1

First of all, unfortunately window.open method does not work at all.
Instead, a < a href="..". >...< /a > works and by default launches Safari and opens the link in a normal browser window (so, if the user wants to come back to the app, he has to doubleclick the iPad key and switch back to it).
You can force the link to open inside the app (so replacing the current page) with the tricks listed here: iPhone Safari Web App opens links in new window

Community
  • 1
  • 1
lucaferrario
  • 990
  • 9
  • 9
  • My links open in the same app window, just dont know if they leave behind an 'open' tab/window. – fancy Nov 28 '11 at 16:36
  • Tested right now in iPad1 with iOS 5.0.1: in my webapp (and I mean an app that has been added to the home and so opened by clicking on the home link at fullscreen), if I click on a link, Safari is launched and the link is opened in a Safari tab. – lucaferrario Nov 29 '11 at 17:51
  • I didn't say it was default behavior... You're not very helpful. – fancy Nov 29 '11 at 20:20
  • Have the same problem and cannot find a good solution anywhere. On my Ipad iOS7 the window.open opens the window (originally meant as a tab) in the same window on home screen use. This is good but from there there is no way back :( – Garavani Aug 27 '14 at 13:11
  • @Garavani: I guess you could then create an iframe and using that as the target for the link. Then you would have control (you could show/hide the iframe and close it when you're done without affecting the parent content). – lucaferrario Aug 28 '14 at 12:13
  • Yes, the iframe solution works. But I wouldn’t like to change the basis of my site just in case of home screen use. I will try to look for browser history solution but I don’t know if this will work with a replaced window content. I have to read and learn about it… Thanks anyhow for comment – Garavani Aug 29 '14 at 05:11
0

Hei, I found a brilliant way to have a "window.open" effect in an iOS webapp too! It loads a page in a Safari tab and has solved my problem, maybe it can be useful to others: http://webdeveloper.com/forum/showpost.php?p=1161159&postcount=14
It's also a great way to avoid the popup blocker (the blocker would stop a window.open(url) call but it doesn't stop that method) :-)

lucaferrario
  • 990
  • 9
  • 9
  • I don't want a window.open effect. – fancy Nov 28 '11 at 16:37
  • 1
    I clearly wrote what it is. This topic is titled "When a user launches new window in a home screen app", so I'm sure that it will be useful for other people, even though it's not useful to you. Demonstration: I solved my problem with it, and when I was looking for resources about my problem I came exactly to this question. – lucaferrario Nov 29 '11 at 17:58