NWJS not persisting already logged in session between restarts
Asked Answered
U

1

0

I have NW.JS desktop application which acts like a web browser. The application is built on 0.45.6 NWJS version.

From last week the desktop stopped saving sessions between restarts, like when user login into the website previously and stop the application and starts again, the website used to logged in already.

I also tried to upgrade the NWJS SDK to latest version 0.52.0 (April 2021) release but it still doesn't work.

The session is maintained during the reload triggered by win.reloadIgnoringCache()

And this is happening for all of the websites.

Is there any session variable parameter added to NWJS with which I can maintain the state? In which direction should I look for the solution for this issue?

Below is package.json content

{
  "name": "app",
  "version": "31.0.1",
  "description": "app",
  "author": "app",
  "license": "UNLICENSED",
  "main": "main.html",
  "nodejs": true,
  "single-instance": true,
  "page-cache": false,
  "scripts": {
    "start": "nw ."
  },
  "node-remote": "<all_urls>",
  "window": {
    "show": true,
    "frame": false,
    "position": "center",
    "width": 800,
    "height": 460,
    "min_width": 800,
    "min_height": 460,
    "resizable": false,
    "icon": "resources/images/favicon.png"
  },
  "dependencies": {
    "crypto": "latest",
    "crypto-js": "latest",
    "jquery": "latest",
    "lodash-core": "^4.17.19",
    "log4js": "latest",
    "node-machine-id": "latest",
    "rimraf": "latest",
    "semver": "latest",
    "shelljs": "latest"
  },
  "chromium-args": "--enable-logging=stderr --disable-gpu --user-data-dir='/Users/sunil/sunil/temp/userdatadir/profile1'"
}
Uncinate answered 18/7, 2021 at 8:3 Comment(0)
C
0

Have you tried removing the following from chromium-args?

--user-data-dir='/Users/sunil/sunil/temp/userdatadir/profile1'

Careerist answered 18/7, 2021 at 12:34 Comment(2)
Yes. It still not works. It stores the profile in default location.Uncinate
I guess I don't understand the question. If it's saving data in the data directory, what isn't working? You say you're reloading the window with reloadIgnoringCache(), so it's not going to keep cached data. Your app needs to load that state data from wherever it was saved, after the reload. This isn't behavior that has changed with NW.js, so I likely don't understand the question. Try clarifying.Careerist

© 2022 - 2024 — McMap. All rights reserved.