Guido Lo Spacy
Guido Lo Spacy

Reputation: 439

mobile safari home screen app - link in a new window / tab

,I have a mobile app that can be added to the home screen and viewed "full screen", by setting:

meta name="apple-mobile-web-app-capable" content="yes"

In my app I have some link to files (mainly images or PDFs), like:

<a href='@Url.Action("Download", "Attachment", new { id = a.Id } )' target="_blank" class="btn btn-sm btn-primary">

The problem is that when the user clicks the link, the image (or the PDF) is correctly displayed, but is then impossible to navigate back! The image is displayed full screen, the user can pinch to zoom, but is impossible to go back (even by using gestures).

The only way to go back is to click the home button and then to re-enter the webapp.

I tried also target="_blank", but this seem to be ignored.

If I stay on Safari (i.e.: I don't add the app to the home screen) or if don't set meta name="apple-mobile-web-app-capable" content="no" the problem don't occur: the image is open in a new tab as expected.

Can be the problem related to the fact that I'm downloading files using MVC? Is this a mobile safari "bug"?

Thanks to everyone!

Upvotes: 0

Views: 1838

Answers (1)

Chris Pratt
Chris Pratt

Reputation: 239270

Yeah, that's how it works. If you mark your website as "apple-mobile-web-app-capable" it better actually be mobile web app capable. This is your way of telling Mobile Safari that you want your website treated as if it were a native app (without all the hardware-level access that actually accompanies a native app, of course). That means you're expected to provide a constant navigation, back buttons, etc., on your own. Loading things like a PDF, need to be done in a content frame while your app's chrome remains on the screen. If you're not actually going to build a mobile web app, don't tell Mobile Safari to treat it that way.

Upvotes: 2

Related Questions