(function() { sessionStorage.setItem('session', document.location.search); // $ Source localStorage.setItem('local', document.location.search); // $ Source $('myId').html(sessionStorage.getItem('session')); // $ Alert $('myId').html(localStorage.getItem('session')); $('myId').html(sessionStorage.getItem('local')); $('myId').html(localStorage.getItem('local')); // $ Alert var href = localStorage.getItem('local'); $('myId').html("foobar"); // $ Alert if (href.indexOf("\"") !== -1) { return; } $('myId').html(""); var href2 = localStorage.getItem('local'); if (href2.indexOf("\"") !== -1) { return; } $('myId').html("\nfoobar"); var href3 = localStorage.getItem('local'); if (href3.indexOf("\"") !== -1) { return; } $('myId').html('\r\n' + "something" + ''); });