This article for everyone to share the JS implementation page A to the page B of the specific methods for reference, the specific content as follows
method One: Use the HTML5 localized storage (localstorage) component (local maximum storage of 5M data) Localstorage is the local persistent storage data, is the cookie optimization
method Two: use cookies to store data in the customer's browser (maximum storage 2M data)
method Three: use URL arguments (save the data to be passed as a stored variable, and then pass to the URL) method as follows;
A.html
var app = {};
App.list = ' 123 '
app.test = ' 1 ';
Window.location.href = "B.html?name=" +APP;
How the argument is the object must first convert the character json.stringify (app), and then convert the word in the B page to the object
B.html
Receive parameters passed by URL
function Getrequest () {
var url = location.search;//Get URL "?" Character string
var therequest = new Object ();
if (Url.indexof ("?")!=-1) {
var str = url.substr (1);
STRs = Str.split ("&");
for (var i = 0; i < strs.length i + +) {
Therequest[strs[i].split ("=") [0]]=unescape (Strs[i].split ("=") [1]);
}
}
return therequest;
}
Console.log (Json.parse (Getrequest (). Name). List)
Each browser has a limit on the length of the URL:
1. IE browser to the length of the URL is limited to 2048 bytes (its own test for up to 2047 bytes).
2.360 Speed browser limits the length of the URL to 2118 bytes.
3. Firefox (Browser) limits the length of the URL to 65536 bytes.
4. Safari (Browser) limits the length of the URL to 80000 bytes.
5. Opera (Browser) limits the length of the URL to 190000 bytes.
6. Google (chrome) limits the length of the URL to 8182 bytes.
Here, I have only tested IE browser and 360 Speed browser, other browsers from the online data.
In addition to remind you, in the URL, a Chinese character through different encoding method size is not the same.
The above is JS to implement a page for another page to pass the parameters of the method, I hope that you learn JavaScript programming help.