How to save cookies with the Chrome Hosted App web browser

I just created my first Chrome app ( https://chrome.google.com/webstore/detail/gitter/ldhcdmnhbafhckhidlhdbeekpifobpdc ) and I got a cookie problem.

The application efficiently loads the index.html page in a window that has a web view pointing to our regular web application.

If I left Chrome on my Mac every time I launch the Chrome Gitter app, all the cookies seem to be destroyed, so I need to log in again (and also log in to GitHub again).

I can’t understand exactly where to start looking, if anyone has any pointers, I would really appreciate it.

PS. I checked this question and answered ( chrome Extension: set persistent cookie in chrome extension? ), And as far as I can tell, my problem is not related to non -expiring cookies, as we set the cookie expiration time.

My manifest is as follows:

{
   "app": {
      "background": {
         "scripts": [ "launch.js" ]
      }
   },
   "description": "Chat for GitHub.",
   "icons": {
      "128": "icon-128.png",
      "16": "icon-16.png"
   },
   "manifest_version": 2,
   "name": "Gitter",
   "short_name": "Gitter",
   "offline_enabled": true,
   "permissions": [
    "unlimitedStorage",
    "notifications",
    "webview",
    "http://*/*"
  ],
   "version": "1.0.0.3"
}

and the page loaded into the window basically does the following:

<webview id="wv1" style="width:100%; height:100%;"
  src="https://gitter.im/">
</webview>
+4
source share
1 answer

I think you need to add an attribute partitionto your tag webviewwith a value starting withpersist:

section

, webview. persist: (partition="persist:googlepluswidgets"), webview , . persist: , webview .

+9

Source: https://habr.com/ru/post/1540748/


All Articles