I am using socket in javascript to emit data. Below is a snippet of code.
socket.on('my response', function(msg) {
$('#log').append('<p>Received: ' + msg.data + '</p>');
/*
if (window.performance) {
console.info("window.performance work fine on this browser");
}
if (performance.navigation.type == 1) {
console.info( "This page is reloaded" );
} else {
console.info( "This page is not reloaded");
} */
document.getElementById('div_id').innerHTML += msg.data + "<br>";
});
The problem is that the data that I display on the div is cleared after the page is reloaded. I want to save data and keep adding data from msg.dataeven after reloading the web page. How can i achieve this? I tried to detect a page reload with the commented part in the code snippet above, but it detects it as a page reload event every time I receive msg.
UPDATE 1
session-storage - , , . This page is reloaded , msg.data ( ). window.location.reload, .