Skip to content

Instantly share code, notes, and snippets.

@dolt131943
Created October 19, 2017 03:58
Show Gist options
  • Save dolt131943/1403a8bf4929212ababf5ee00e9ecc64 to your computer and use it in GitHub Desktop.
Save dolt131943/1403a8bf4929212ababf5ee00e9ecc64 to your computer and use it in GitHub Desktop.
nwjs禁止缓存处理
  1. 在nwjs启动时清空缓存;
let gui = require('nw.gui');
  let tray;

  gui.App.clearCache();
  1. HTTP服务器返回添加禁止缓存标识;
     add_header Cache-Control no-cache;
     add_header Cache-Control private;
  1. HTML添加禁止缓存信息;
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment