views:

28

answers:

3

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

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

+1  A: 

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

Mowgli
+1  A: 

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.

Franci Penov
except the hash is not sent to the server... it is just in the address bar and in bookmark and history, and for the browser to go to the anchor if there is one (but right now the hash is used for ajax history and bookmark purpose)
動靜能量
+1  A: 

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.

jeffamaphone