如何使用独立浏览器分离 PWA 会话和 cookie?(PWA 作为私人标签) [英] How to separate PWA session and cookie with a standalone browser? ( PWA as private tab )

查看:58
本文介绍了如何使用独立浏览器分离 PWA 会话和 cookie?(PWA 作为私人标签)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与企业应用服务器一起开发 PWA.

I'm working on a PWA in conjunction with an enterprise application server.

应用服务器为独立浏览器提供响应式 Web 视图,并借助首次在 PWA 启动 url 上设置的 PWA cookie 自定义 PWA 上的视图.

The application server serves a responsive web view for a standalone browser, and customize the view on PWA with the help of PWA cookie which is set on PWA start url for the first time.

问题是 PWA 和独立浏览器(例如 Android 上的 Chrome)之间的会话正在共享,一旦用户安装了 PWA,随后使用独立浏览器访问站点将显示 PWA 自定义视图.

The problem is that the session between PWA and a standalone browser ( e.g Chrome on Android ) is being shared and once the user has installed the PWA, the consequent visits to the site with the standalone browser will show the PWA customized view.

有没有办法将 PWA 中的会话和设备中的独立浏览器分开?即将 PWA 视为私人标签?

Is there any way to separate sessions in PWA and standalone browser in device?I.e. to treat PWA as a private tab?

或者其他方式?

推荐答案

我遇到了类似的情况,我认为解决方案是区分 cookie 和/或会话的名称.例如 - 我登录的用户有一个 SESSION['Key'] 但对于我的应用程序,我必须创建一个 SESSION['AppKey'].它将(就像我的情况一样)需要对您的代码进行一些修改,但我认为没有其他选择.

I am in a similar situation and believe the solution is to differentiate the names of your cookies and/or sessions. So for example - my logged in user has a SESSION['Key'] but for my App I'll have to create one SESSION['AppKey']. It will (as in my case) require a bit of reworking of your code but I don't believe there is any alternative.

值得注意,尽管 IOS 似乎将 Cookie 与浏览器和 PWA 分开,因此您可能会发现使用基于 IOS 的设备测试您的场景可能会如您所愿.

It is worth noting though that IOS appears to separate Cookies from the browser and PWA so you may find testing your scenario with an IOS based device may work as you expect.

这篇关于如何使用独立浏览器分离 PWA 会话和 cookie?(PWA 作为私人标签)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆