本文介绍了iPhone“Bookmark to Homescreen”删除cookie和会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在开发一个基于Web的应用程序,用户必须首先登录。

Right now I am developing a Web-based Application, where the User has to login first.

当我通过iPhone Safari打开页面时,登录并重新启动Safari ,我仍然登录(Cookie和会话ID仍然设置)。

When I open the Page by iPhone Safari, login and restart Safari, I am still logged in (Cookie & Session ID still set).

但是当我添加此页面时,添加到主屏幕,每次我点击该页面的图标,我必须再次登录。

But when I add this Page with "Add to Home Screen", each Time i click the Icon for that page, I have to login again.

我没有找到任何相关的信息。我该怎么做才能让我的用户将此页面设置为主屏幕
作为图标,并且每次打开它时仍然无需登录?

I did not find any information about that. What can I do so my users can set this page to their home screenas icon and still don't have to login each time they open it?

推荐答案

一种非常简单的方法可能是在Bookmark-URL中使用一个唯一的令牌,它可以作为唯一的设备标识符。

A really simple approach could be to use a unique token in your Bookmark-URL which can serve you as a unique device identifier.

示例:

可以在Mobile Safari中的应用程序打开时以及在添加到主屏幕信息提示用户之前,在服务器端生成令牌。
然后可以使用快速重定向(...& token = randomToken)或位置哈希(...#randomToken)将令牌添加到URL。

The token can be generated at the server side at opening time of the application in Mobile Safari and before the user is prompted with the "Add to Home Screen" information.The token can then be added to the URL using a quick redirect (…&token=randomToken) or a location hash (…#randomToken).

现在,只要从主屏幕打开书签,令牌就会发送到您的服务器,您可以识别用户的活动会话。
您也可以将令牌用作永久会话ID,但出于安全考虑,我建议不要这样做。

Whenever the Bookmark is now opened from the Home Screen, the token is sent to your server and you can identify the user's active session.You may also use the token as a permanent session id, but I advise against that because of security concerns.

为了允许将来的注销和登录程序,总是可以将新会话分配给令牌。

To allow future logout and login procedures, you can always assign the new sessions to the token.

只要用户从主屏幕重新打开链接,令牌就会将您作为唯一的设备标识符。

The token will serve you as a unique device identifier whenever the user will re-open your link from his Home Screen.

这篇关于iPhone“Bookmark to Homescreen”删除cookie和会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 05:34