Chrome custom tabs cookies, storage APIs and service worker

人走茶凉 提交于 2019-12-11 03:06:25

问题


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. 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?

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?

Thanks in advance


回答1:


  1. Chrome Custom Tabs uses the same Cookie jar as Chrome. So, if a Cookie is created when a user accesses the page from a Custom Tab and Chrome is the Custom Tabs provider, it is also available when the user goes to the same domain from Chrome (outside Custom Tabs).
  2. Same as above.
  3. Yes, it is possible to install a service-worker from a Chrome Custom Tab.

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.



来源:https://stackoverflow.com/questions/38494060/chrome-custom-tabs-cookies-storage-apis-and-service-worker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!