Chrome自定义标签Cookie,存储API和服务工作者 [英] Chrome custom tabs cookies, storage APIs and service worker

查看:114
本文介绍了Chrome自定义标签Cookie,存储API和服务工作者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从stackoverflow查找许多答案,但找不到与此相关的任何东西,我正在实施支付应用程序,并且我想在我的应用程序中显示自定义标签,以通过存储用户ID或设置cookie来记录用户访问

I tried to lookup many answers from stackoverflow but couldnt find anything specific to this, I am implementing payment app and I want to display custom-tab in my app to record user visit by storing user-id, either by setting a cookie or using localstorage or by installing a service worker for the domain that custom tabs opens.


  1. 在自定义标签中加载的https页面是否可以写入Cookie,或者使用localstorage或为自定义标签打开的域安装服务工作者。
  1. Can a https page loaded in custom-tab write cookies that are also available when visiting the same page from Chrome?
  2. Is localstorage API available for my domain in custom-tab? if yes, is stored value available from Chrome?
  3. Is installing service worker allowed from Custom-tab? So I have access to S/W from Chrome browser?

如果这都不可行,我该如何记录从自定义标签访问并在用户从Chrome浏览器中打开域时在Chrome中可用?

If none of this possible, how could I record the visit from custom-tab and have it available in Chrome when user opens the domain from chrome browser?

预先感谢

推荐答案


  1. Chrome自定义标签页使用与Chrome相同的Cookie罐。因此,如果用户从自定义标签访问页面时创建了Cookie,而Chrome是自定义标签提供者,则当用户从Chrome转到同一个域(自定义标签之外)时,它也可用。

  2. 与上述相同。

  3. 是的,可以从Chrome自定义标签安装服务工作者。

您可以通过打开添加cookie的URL,安装服务工人或写入其中的本地商店来检查以上所有内容自定义标签,设置设备进行调试,将其连接到计算机并导航到 chrome:// inspect /#devices 在Chrome中。然后选择设备并检查Cookie,本地存储,服务人员等。

You can check all the above by opening the URL that adds the cookie, install the service-worker or writes to the local store inside a Custom Tab, setup the device for debugging, connecting it to your computer and navigating to chrome://inspect/#devices in Chrome. Then choose the device and inspect the cookies, local storage, service-workers, etc.

这篇关于Chrome自定义标签Cookie,存储API和服务工作者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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