JSFiddle - React, Tailwind, and code Playground
HTML
<p>Loading...</p>
JavaScript
jQuery(function ($) {
$(window).bind('beforeunload', function () {
window.open("", "_savedata", "titlebar=0,width=100,height=100").saveFunction = window.saveFunction;
});
var store = window.open("", "_savedata");
window.saveFunction = store.saveFunction ? store.saveFunction : (function () {
var lulz = 42
return function () {
lulz += 1;
return lulz
}
}());
store.close();
alert(window.saveFunction());
});