Resolving the parent class loading IFRAME,SRC parameter too large causes the load to fail

Source: Internet
Author: User

<iframe src= "*******.do?param=****" id= "Leftframe" name= "leftframe" frameborder= "0" ></iframe>


or, use JS to load src:


var params = "pk_id=" +PK_ID;


var frameleftsrc = "<%=path%>/****/****.do" +params;


$ (' #leftFrame '). attr ("src", frameleftsrc);


(for example, here is a single argument, which may actually have multiple parameters.) We continue)


The above two kinds of writing, can implement the IFRAME loading, we may think that no problem, is correct. In fact, the above is really not a big problem, the value of the parameter is not long, attention is the length of the value of the parameter, not the number of parameters. For example, I want to pass a parameter to this IFRAME, the parameter is called PK_ID, the value is a long string of primary key which is returned by the main page or other page to join together the value, at least 3,000 characters above, this time we again use this method to access the problem. Because this URL method is submitted through get, the length of the parameter is limited.


So what do I do with this big data transfer, and there are two things I think about at the moment (everyone has a better offer to talk about, communicate with each other, improve each other):


One, still pass this way , but the value of the parameter is not too long, if not long parameter value can be associated with the query to the long parameter value you want, so that the IFRAME receives this not long parameter value, You'll find a way to get the long parameter value you want in the IFRAME sub-page. (Can be used, but not recommended, because a precondition is required)


second, in the main page using the following methods, to load the IFRAME page can:


Main Page: <iframe src= "About:blank" id= "Leftframe" name= "leftframe" frameborder= "0" >


JS:


var url= "<%=path%>/pubitem/tochoosepubitemleft.do";//action to define form form for IFRAME page


//define form forms
var html1= ' <form id= "Queryform" name= "Queryform" method= "post" target= "_self" action= "' +url+ '" > ' +
' <input type= ' hidden "id=" pk_id "name=" pk_id "value=" ' +pk_id+ ' "/> ' +//pk_id is a value longer than 3000 characters
' </form> ';
document.getElementById (' Leftframe '). ContentWindow.document.write (HTML1); Write the form to the IFRAME
document.getElementById (' Leftframe '). ContentWindow.document.getElementById (' Queryform '). Submit ();// Perform the submission of forms in an IFRAME


wrapping the above method inside a method, and then calling this method when the main page is loaded, will pass the big data on the main page to the IFRAME page.

Resolving the parent class loading IFRAME,SRC parameter too large causes the load to fail

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.