User:Ajit kolathur/common.js

function recordClick(fromPage, toPage){ fromPage = fromPage.split("#")[0].split("?")[0]; toPage = toPage.split("#")[0].split("?")[0];

if (localStorage.getItem(fromPage) != null) { tos = JSON.parse(localStorage.getItem(fromPage)); if (tos.indexOf(toPage) == -1) { tos.push(toPage); localStorage.setItem(fromPage, JSON.stringify(tos)); }	}	else { localStorage.setItem(fromPage, JSON.stringify([toPage])); }

// Retrieve the object from storage var retrievedObject = localStorage.getItem(fromPage);

console.log('retrievedObject: ', JSON.parse(retrievedObject)); }