Restart game javascript command?Keep variable value on restart?

I need to know how to do 2 things in my game:

First, how do i restart the game, using a javascript call?(When i press F5, it changes the resolution back to default 816x624. Will this javascript call do the same? If so, how to i avoid it?).I need it to reload everything again in a certain moment.

And second, does MV keep the value of a variable when it launch?(Let's say i, inside options menu, change variable "5" from 1 to 2.If i close the game and open again, does it keep being 2?)Also, using the script to restart the game, will it keep the same way?
If not, how do i save it being inside the title menu?
Hi,

Searching rpg_managers.js for "F5" yielded this function:
Spoiler
SceneManager.onKeyDown = function(event) {
if (!event.ctrlKey && !event.altKey) {
switch (event.keyCode) {
case 116: // F5
if (Utils.isNwjs()) {
location.reload();
}
break;
case 119: // F8
if (Utils.isNwjs() && Utils.isOptionValid('test')) {
require('nw.gui').Window.get().showDevTools();
}
break;
}
}
};
Maybe you could try a script call with this:
Spoiler
location.reload();
and see if it works for you 😀

And second, does MV keep the value of a variable when it launch?(Let's say i, inside options menu, change variable "5" from 1 to 2.If i close the game and open again, does it keep being 2?)Also, using the script to restart the game, will it keep the same way?
If not, how do i save it being inside the title menu?
As far as I know MV doesn't work like this by default. If you want to have a persistent game variable you could try to save on disk as a file.
I believe I once saw a plugin that did this but I can't recall which one was.

Original thread: https://forums.rpgmakerweb.com/threads/restart-game-javascript-command-keep-variable-value-on-restart.89312/