开发者

URL cannot be more than 2k in length for IE, but what about ajax URL and does it include hash in URL?

开发者 https://www.devze.com 2023-01-06 08:08 出处:网络
When IE does Ajax, does the 2k length limit still apply for URL?(or is it only for the URL on the address bar开发者_StackOverflow)

When IE does Ajax, does the 2k length limit still apply for URL? (or is it only for the URL on the address bar开发者_StackOverflow)

What about URL with the hash portion together exceeding 2k but without the hash, it is less than 2k?


All IE requests go through Wininet. Have a look at the SDK header files:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include>findstr /spin /c:"INTERNET_MAX" *.h
WinInet.h:85:#define INTERNET_MAX_HOST_NAME_LENGTH   256
WinInet.h:86:#define INTERNET_MAX_USER_NAME_LENGTH   128
WinInet.h:87:#define INTERNET_MAX_PASSWORD_LENGTH    128
WinInet.h:88:#define INTERNET_MAX_PORT_NUMBER_LENGTH 5           // INTERNET_PORT is unsigned short
WinInet.h:89:#define INTERNET_MAX_PORT_NUMBER_VALUE  65535       // maximum unsigned short value
WinInet.h:90:#define INTERNET_MAX_PATH_LENGTH        2048
WinInet.h:91:#define INTERNET_MAX_SCHEME_LENGTH      32          // longest protocol name length
WinInet.h:92:#define INTERNET_MAX_URL_LENGTH         (INTERNET_MAX_SCHEME_LENGTH \
WinInet.h:94:                                        + INTERNET_MAX_PATH_LENGTH)
WinInet.h:1712:#define MAX_GOPHER_HOST_NAME        INTERNET_MAX_HOST_NAME_LENGTH
WinInet.h:1720:                                    + INTERNET_MAX_PORT_NUMBER_LENGTH   \
Winineti.h:1511:#define URL_LIMIT INTERNET_MAX_URL_LENGTH

So, yes, that length limitation applies.


The URL length limit includes all parts of the URL, including host, user info, path, fragment and query parameters. The limit is applied to any request (GET, PUT, POST, DELETE and so on). It's an actual WinInet limitation, not an IE address bar limitation, so it applies to AJAX requests as well.

If you need to send long data to the server, you should consider doing a POST with the data in the body of the request.


Not entirely sure about that but you can avoid this restriction by using POST instead of GET

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号