Workaround for too long querystring in IE6, IE7?

点点圈 提交于 2019-12-22 08:52:03

问题


I have a form which submits fine in FF, Opera, Safari, Chrome, and also IE8... But it wont submit in IE6, or IE7...

I have noticed it is 99% sure that the problem is a too long querystring. I have many many options...

Now, changing the method to POST is out of the question here, so don't bother asking about this please...

I wonder, is there any other workaround for this problem? Also, why is only IE6 and IE7 having this problem?

If there is no workaround, will "disabling" the "too many" inputs which are over the limit help shortening the querystring? In other words, will disabled form elements also be added to the querystring?

Thanks


回答1:


To answer your second question, Microsoft's got the answer here: http://support.microsoft.com/kb/208427 The maximum URL is 2,083 characters, so the page resulting from the GET request must have a URL shorter than that.

To answer your third question, w3.org/TR/html401/interact/forms.html#h-17.12: "Disabled controls can not be successful", i.e. they will not submit.

To answer your first, perhaps you can put a character limit on some of the fields, like a textarea. Another option might be to compress the input using javascript, hashing it somehow, and then unhashing it server-side on the submitted page.




回答2:


If you're sure that that's the issue, and not the million other cross browser problems, you could try an ajax call. Split up the query into 2, 3, n calls.

Is it just a form? May I ask why POST is out of the question?




回答3:


its not great, but you could putt the value(s) in a cookie




回答4:


To answer your last question first Disabled form inputs are NOT GETted or POSTed back to the server

If posting isn't an option, you can try eliminate non-essential form inputs, and although cheesy, reduce the length of the NAMEs of your elements will also shorten the Querystring.




回答5:


You can also try to do some client side compression of the query string values in JavaScript.

I have had some success using base 93 encryption to get a significant reduction in string size.

You can also try huffman compression, although it is more processor heavy.

http://rumkin.com/tools/compression/compress_huff.php

If you are only expecting a limited character set (lowercase a-z) you could come up with a few other tricks.




回答6:


Query string too long error can be avoided by a simple IIS settings change. http://www.mytecbits.com/microsoft/iis/query-string-too-long



来源:https://stackoverflow.com/questions/3551116/workaround-for-too-long-querystring-in-ie6-ie7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!