JSFiddle - React, Tailwind, and code Playground
JavaScript
jQuery(function ($) {
$(window).bind('beforeunload', function () {
window.open("", "_savedata", "titlebar=0,width=100,height=100").saveData = window.saveData;
});
var store = window.open("", "_savedata"),
paragraph = $("p")[0];
window.saveData = store.saveData ? store.saveData + " and again" : "restored data again";
store.close();
if (paragraph.textContent) {
paragraph.textContent = window.saveData;
} else {
paragraph.innerText = window.saveDate;
}
});