Hello, tell me how to do to clear the cache in applications AppData\Roaming\
I found the function menu button, can you do something like that at the closing of the outlet or remove the application cache?
Thanks.
$ nativefier --version): v7.0.1$ node --version): v7.4.0Windows32, 64I found the cache cleaning feature on the menu button, tell me whether it is possible to insert it before exiting? I can not understand what the function of the output of the application is responsible.
Thank you.
const clearAppData = () => {
dialog.showMessageBox(mainWindow, {
type: 'warning',
buttons: ['Yes', 'Cancel'],
defaultId: 1,
title: 'Clear cache confirmation',
message: 'This will clear all data (cookies, local storage etc) from this app. Are you sure you wish to proceed?'
}, response => {
if (response === 0) {
const session = mainWindow.webContents.session;
session.clearStorageData(() => {
session.clearCache(() => {
mainWindow.loadURL(options.targetUrl);
});
});
}
});
};
anyone get this work ???
+1
I would really appreciate to get this feature.
if any one need this just
i add clear Storage Data order to close
just replace this in \resources\app\lib\main.js mainWindow.on('close', function(event)
with
mainWindow.on('close', function(event) {
if (mainWindow.isFullScreen()) {
if (nativeTabsSupported()) {
mainWindow.moveTabToNewWindow();
}
mainWindow.setFullScreen(false);
mainWindow.once('leave-full-screen', maybeHideWindow.bind(_this, mainWindow, event, options.fastQuit));
}
maybeHideWindow(mainWindow, event, options.fastQuit, options.tray);
var session = mainWindow.webContents.session;
session.clearStorageData(function() {
session.clearCache(function() {
});
});
});
and it's will working every time you close app (Ctrl+w)(alt+f4) or close menu button will clear c Storage Data, Cookies cache, etc.
i will try to add it to when app start too to be sure everything is cleared
It would be a nice feature, if it would only delete cookies, which are for other origins than the --internal URLs.
If you're just looking to clear cache:
(not my code, just taken from Amrzxc)
var session = mainWindow.webContents.session;
session.clearStorageData(function() {
session.clearCache(function() {
});
});
Most helpful comment
if any one need this just
i add clear Storage Data order to close
just replace this in \resources\app\lib\main.js mainWindow.on('close', function(event)
with
mainWindow.on('close', function(event) { if (mainWindow.isFullScreen()) { if (nativeTabsSupported()) { mainWindow.moveTabToNewWindow(); } mainWindow.setFullScreen(false); mainWindow.once('leave-full-screen', maybeHideWindow.bind(_this, mainWindow, event, options.fastQuit)); } maybeHideWindow(mainWindow, event, options.fastQuit, options.tray); var session = mainWindow.webContents.session; session.clearStorageData(function() { session.clearCache(function() { }); }); });and it's will working every time you close app (Ctrl+w)(alt+f4) or close menu button will clear c Storage Data, Cookies cache, etc.
i will try to add it to when app start too to be sure everything is cleared