This article mainly introduces how to solve the problem when the url data volume in window. location. href is too large. For more information, see the following:
To export an excel file, you need to upload a large amount of data to the background after pressing the button. The procedure is as follows:
The Code is as follows:
Var actionUrlSetData = "***** Action! ExportDatas. action "+ "? Now = "+ new Date (). getTime ();
Window. location. href = actionUrl + "&" + data;
The above data is a long string.
In this way, Firefox and Google browsers are no problem, but ie9 (Other ie did not try, it should be the same) will not be able to export normally
The cause of this problem is that various browsers have different restrictions on URL resolution length. ie is the smallest one, so the problem arises.
Microsoft Internet Explorer (Browser)
The maximum length of a URL in IE is 2083 characters. If this number is exceeded, the submit button does not respond.
Firefox (Browser)
The URL Length of the Firefox browser is limited to 65,536 characters
Safari (Browser)
The maximum length of a URL is 80,000 characters.
Opera (Browser)
The maximum length of a URL is 190,000 characters.
Google (chrome)
The maximum url length is 8182 characters.
Note that the WEB server has a limit on the URL length !!
Therefore, you cannot use the Get method. You can only use the post method to pass the value, so that you can use the following solution. If you do not know whether it is correct, please give pointers. In short, the function can be implemented.
The idea is to use post to upload the long string to the background, save it to the session, and use window. location. href in The post callback method.
The Code is as follows:
The Code is as follows:
$. Post (actionUrlSetData, mapList, function (){
Var actionUrl = path + "/*** action! ExportDatas. action "+ "? Now = "+ new Date (). getTime ();
Window. location. href = actionUrl + "&" + (data );
});