This is my first HTML page:
Probably the best way in your case to use GET params like:
http://mysite//second.html?myparams=value
or if it's important or big data - use POST
Found a solution for you to parse GET variables:
// Read a page's GET URL variables and return them as an associative array.
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
Get URL parameters & values with jQuery
If you are not using html5, you have these ways to pass the value from one html to another - QueryString/GET/Cookies.
HTML5 provides two objects localStorage and sessionStorage to save the client data. Both allow user to store the data on local machine. Provides two methods - getItem('Key') and setItem('Key','Value') or we can just store the data in array of localStorage or sesionStorage;
// Store
localStorage.setItem("lastname", "abc");
// Retrieve
document.getElementById("result").innerHTML = localStorage.getItem("lastname");
The sessionStorage object is similar to the localStorage object except it stores the data for only one session. The data is deleted when user closes the window.
to remove any item from session:
localStorage.removeItem("lastname");
to store as an array:
for (item in items) {
localStorage[item] = AnyArray[item];
}
in HTML5 you can use session to pass object from page to another:
1- create a sesison
sessionStorage.setItem('key', 'value');
2- read session:
sessionStorage.getItem('key')
check this example