How to disable caching of remote scripts and stylesheets when executing node-webkit based applications?

8 views
Skip to first unread message

coryge...@gmail.com

unread,
Mar 26, 2013, 12:01:53 AM3/26/13
to node-...@googlegroups.com

I'm using node-webkit to create a desktop application from an intranet site with a lot of external scripts and stylesheets. An issue I've noticed when debugging is that it seems to cache the external scripts and stylesheets sporadically between different runs - sometimes it will load a recently modified script and other times it will not without turning on the addressbar and typing the script path in manually then hitting reload. Is there any way to make it so every time it loads it is getting a fresh copy of the dependencies?

The package.json I'm using is below:

{
    "name": "name",
    "description": "description",
    "version": "0.1",
    "main": "https://path-to-intranet-site/",
    "node-remote": "https://path-to-intranet-site",
    "window": {
        "show": true,
        "toolbar": true,
        "frame": true,
        "position": "center",
        "width": 800,
        "height": 600,
        "min_width": 220,
        "min_height": 220
    }
}

Steve Verbeek

unread,
Mar 26, 2013, 12:24:42 PM3/26/13
to node-...@googlegroups.com, coryge...@gmail.com
Have you tried the regular way of appending a random string to the end of the url?


or something?

Steve Verbeek

unread,
Mar 26, 2013, 12:27:30 PM3/26/13
to node-...@googlegroups.com, coryge...@gmail.com
Have you tried the regular method of appending a random string to the end of the URL?



On Tuesday, 26 March 2013 01:01:53 UTC-3, coryge...@gmail.com wrote:

coryge...@gmail.com

unread,
Mar 26, 2013, 8:49:27 PM3/26/13
to node-...@googlegroups.com, coryge...@gmail.com
It isn't a requirement within Chrome and since node-webkit is based on Chrome I am looking for a way to override it's default settings, not a hack solution.

Christopher de Beer

unread,
Mar 27, 2013, 6:35:47 AM3/27/13
to node-...@googlegroups.com, coryge...@gmail.com
For those of us that have to work on the front end, and support chromes aggressive caching, I think you'll find that while there are other solutions, the "hack" mentioned above by @steve is the prefered (read: most reliable) solution. 

+1

coryge...@gmail.com

unread,
Mar 27, 2013, 6:40:54 AM3/27/13
to node-...@googlegroups.com, coryge...@gmail.com
I agree that it's the most reliable method, but in the actual Chrome browser it's not required, only in node-webkit.  In Chrome I can hit the refresh button and all the scripts refresh but in node-webkit turning on the toolbar and using it's refresh button doesn't work (the script has to be manually loaded into the address bar and refreshed) so it seems specific to node-webkit.

Chris Turnbull

unread,
Apr 2, 2013, 7:52:51 PM4/2/13
to node-...@googlegroups.com, coryge...@gmail.com
It's not exactly specific to node-webkit. In Chrome, if you just go to a page (rather than refresh), then you'll probably see exactly the same thing.

The only issue is that in node-webkit a user has no way to force a refresh. Adding either a timestamp or a random string to the URL as mentioned above should overcome it without too much difficulty.

a.tumi...@gmail.com

unread,
Apr 3, 2013, 8:57:10 AM4/3/13
to node-...@googlegroups.com, coryge...@gmail.com
I have the same problem. My application dynamically load scripts to the application. In Chrome browser check whether the file was changed. Node-webkit does not check it. As result it does not update scripts.
Reply all
Reply to author
Forward
0 new messages