When running a mobile site in iOS full screen mode, using the "apple-mobile-web-app-capable" meta tag, I am using a combination of AJAX and synchronous page requests, including redirects, with success while the user is logged in.

However, when the user logs out and the session is destroyed, the iOS device leaves full screen mode and opens the login page in a Mobile Safari window.

Here is a common sequence of events:

  1. User clicks button on Home Screen to launch mobile site in iOS full screen mode
  2. Server redirects user to login page for authentication (still in full screen)
  3. User logs in, and is redirected back to mobile home (still in full screen)
  4. User performs various actions, via GET and POST, some using AJAX and some not (still in full screen)
  5. User hits logout button, which destroys session and redirects back to login page
  6. Mobile Safari window opens to render login page this second time

I have tried 301, 302 and 303 redirects on logout success and nothing seems to change this behavior. It seems related to the user's session ending when running in full screen mode. I don't think this matters, but the security mechanism is implemented via Spring Security running on Tomcat.

Is there any way to prevent this behavior? I would prefer not to use a location.href client side redirect on logout.

有帮助吗?

解决方案

You can cancel a links default behaviour by using jQuery's event delegation to assign a single, top-level event handler to all links on the page. When a click event is detected, we cancel the default behavior (which is to open in mobile Safari) and then manually change the window's location. This approach allows the page to be changed without breaking the iPhone standalone application experience.

http://www.bennadel.com/blog/2302-Preventing-Links-In-Standalone-iPhone-Applications-From-Opening-In-Mobile-Safari.htm

I was under the impression from running into this previously that any non-ajax/ javascript navigation would cause the app to jump into safari to serve the page

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top