Knowledge (XXG)

Query string

Source 📝

719:. For this to work, every time the user downloads a page, a unique identifier must be chosen and added as a query string to the URLs of all links the page contains. As soon as the user follows one of these links, the corresponding URL is requested to the server. This way, the download of this page is linked with the previous one. 23:
is a part of a uniform resource locator (URL) that assigns values to specified parameters. A query string commonly includes fields added to a base URL by a Web browser or other client application, for example as part of an HTML document, choosing the appearance of a page, or jumping to positions in
929:
and store the parameters in the request body. The length limits on request bodies are typically much higher than those on URL length. For example, the limit on POST size, by default, is 2 MB on IIS 4.0 and 128 KB on IIS 5.0. The limit is configurable on Apache2 using the
707:
A program receiving a query string can ignore part or all of it. If the requested URL corresponds to a file and not to a program, the whole query string is ignored. However, regardless of whether the query string is used or not, the whole URL including it is stored in the server
62:
path or by handling the request using logic that is specific to the type of resource. In cases where special logic is invoked, the query string will be available to that logic for use in its processing, along with the path component of the URL.
892:
Different query strings passed by different visits to the page will mean that the pages are never served from the browser (or proxy, if present) cache thereby increasing the load on the web server and slowing down the user
882:
Query strings form part of the URL, and are therefore included if the user saves or sends the URL to another user; cookies can be maintained across browsing sessions, but are not saved or sent with the
348:
element is deprecated and most browsers no longer support or render it, there are still some vestiges of indexed search in existence. For example, this is the source of the special handling of
910:
Various ad hoc limitations on request-line length are found in practice. It is RECOMMENDED that all HTTP senders and recipients support, at a minimum, request-line lengths of 8000 octets.
91:
may provide methods for parsing multiple parameters in the query string, separated by some delimiter. In the example URL below, multiple query parameters are separated by the
852:
The addition of the query string does not change the way the page is shown to the user. When the user follows, for example, the first link, the browser requests the page
886:
If the user arrives at the same web server by two (or more) independent paths, it will be assigned two different query strings, while the stored cookies are the same.
410:
to deal with this problem, while HTML forms make some additional substitutions rather than applying percent encoding for all such characters. SPACE is encoded as '
889:
The user can disable cookies, in which case using cookies for tracking does not work. However, using query strings for tracking should work in all situations.
424:
specifies the following transformation for submitting HTML forms with the "GET" method to a web server. The following is a brief summary of the algorithm:
1066: 315:
attribute. This was intended to allow web servers to use the provided text as query criteria so they could return a list of matching pages.
871:, making it possible to establish that all these pages have been viewed by the same user. Query strings are often used in association with 253:. Web forms may include fields that are not visible to the user; these fields are included in the query string when the form is submitted. 934:
directive, which specifies the number of bytes from 0 (meaning unlimited) to 2147483647 (2 GB) that are allowed in a request body.
394:
cannot be part of a URL (for example, the space) and some other characters have a special meaning in a URL: for example, the character
307:
element as a single-line text-input control. The text entered into this control was sent to the server as a query string addition to a
1262: 1091: 269: 28: 1211: 109:
The exact structure of the query string is not standardized. Methods used to parse the query string may differ between websites.
272:
query strings in URLs within HTML documents without having to entity escape ampersands. Since 2014, W3C recommends to use only
376:' (as per section 4.4 of CGI 1.1). Some CGI scripts still depend on and use this historic behavior for URLs embedded in HTML. 964: 81:
When a server receives a request for such a page, it may run a program, passing the query string, which in this case is
980: 903: 429: 356:' within browser URL percent encoding (which today, with the deprecation of indexed search, is all but redundant with 1128: 915: 969: 685: 361: 240: 318:
When the text input into the indexed search control is submitted, it is encoded as a query string as follows:
1115: 85:, unchanged to the program. The question mark is used as a separator, and is not part of the query string. 1053: 1141: 709: 391: 692: 1153: 1238: 399: 329:
The query string is composed of a series of arguments by parsing the text into words at the spaces.
715:
These facts allow query strings to be used to track users in a manner similar to that provided by
688: 509:") is permitted in query strings by RFC3986 but required to be percent-encoded in HTML forms to " 501:
representation with any non-ASCII characters first encoded as UTF-8 (or other specified encoding)
365: 948: 279:
The form content is only encoded in the URL's query string when the form submission method is
260:
recommendation. In the recommendations of 1999, W3C recommended that all web servers support
651:
and the user inserts the strings "this is a field" and "was it clear (already)?" in the two
407: 385: 878:
The main differences between query strings used for tracking and HTTP cookies are that:
996: 663: 867:
This way, any subsequent page request from this user will carry the same query string
368:) will process the query string into command line arguments if it does not contain an 1251: 520:' and the selection of "as-is" characters distinguishes this encoding from RFC 3986. 229: 88: 36: 1226: 1257: 1189: 986: 943: 670: 288: 428:
Characters that cannot be converted to the correct charset are replaced with HTML
1037: 179:
is submitted, the content of the fields is encoded as a query string as follows:
975: 922: 716: 498: 369: 300: 284: 194: 164: 121: 55: 32: 1022: 1001: 991: 926: 872: 681: 529: 308: 280: 213: 959: 349: 333: 273: 265: 261: 205: 132: 92: 1171: 167:, also known as web form. In particular, when a form containing the fields 27: 652: 421: 406:
is used to separate a name from a value. The URI generic syntax uses
283:. The same encoding is used by default when the submission method is 722:
For example, when a web page containing the following is requested:
112:
A link in a web page may have a URL that contains a query string.
51: 26: 232:
allow multiple values to be associated with a single field (e.g.
533: 113: 1092:"uri – Authoritative position of duplicate HTTP GET query keys" 673:
in the above example) will receive the following query string:
193:
Within each pair, the field name and value are separated by an
116:
defines three ways a user agent can generate the query string:
953: 675:
first=this+is+a+field&second=was+it+clear+%28already%29%3F
257: 221: 190:
The query string is composed of a series of field-value pairs.
59: 40: 104:
https://example.com/path/to/page?name=ferret&color=purple
864:
as expected, adding the query string to its links as well.
691:, the script may typically receive the query string as an 163:
One of the original uses was to contain the content of an
1036:
T. Berners-Lee; R. Fielding; L. Masinter (January 2005).
1021:
T. Berners-Lee; R. Fielding; L. Masinter (January 2005).
311:
request for the base URL or another URL specified by the
16:
Part of a URL that assigns values to specified parameters
914:
If the URL is too long, the web server fails with the
71:
A typical URL containing a query string is as follows:
184:
field1=value1&field2=value2&field3=value3...
921:The common workaround for these problems is to use 312: 291:body rather than being included in a modified URL. 136: 234:field1=value1&field1=value2&field2=value3 54:(HTTP) request either by reading a file from its 789:is chosen, and the page is modified as follows: 398:can be used to further specify a subsection (or 1217:, HTML5.2, W3C recommendation, 14 December 2017 1143:, HTML5.2, W3C recommendation, 14 December 2017 320: 181: 101: 73: 402:) of a document. In HTML forms, the character 243:of the form, the query string contains a pair 1116:Performance, Implementation, and Design Notes 8: 1241:. Httpd.apache.org. Retrieved on 2013-09-08. 228:While there is no definitive standard, most 1049: 1047: 655:and presses the submit button, the program 303:were added to HTML, browsers rendered the – 856:to the server, which ignores what follows 76:https://example.com/over/there?name=ferret 150:an indexed search via the now deprecated 204:The series of pairs is separated by the 1013: 505:The octet corresponding to the tilde (" 494:All other characters are encoded as a 287:, but the result is submitted as the 7: 1229:. ietf.org. Retrieved on 2014-07-31. 360:). Also some web servers supporting 1227:HTTP/1.1 Message Syntax and Routing 345: 304: 151: 144: 140: 125: 1118:. W3.org. Retrieved on 2013-09-08. 1056:. W3.org. Retrieved on 2013-09-08. 1025:. "Syntax Components" (section 3). 45:title=Query_string&action=edit 14: 1213:application/x-www-form-urlencoded 834:"bar.html?e0a72cb2a2c7" 806:"foo.html?e0a72cb2a2c7" 270:application/x-www-form-urlencoded 1158:HTML (HyperText Markup Language) 680:If the form is processed on the 323:argument1+argument2+argument3... 126:<form>...</form> 332:The series is separated by the 659:(the program specified by the 1: 1190:"HTML URL Encoding Reference" 1067:"ServletRequest (Java EE 6 )" 553:"/cgi-bin/test.cgi" 220:" are not recommended by the 430:numeric character references 981:HyperText Transfer Protocol 52:Hypertext Transfer Protocol 1281: 956:(Uniform Resource Locator) 516:The encoding of SPACE as ' 383: 264:separators in addition to 50:A web server can handle a 1263:String (computer science) 1239:core – Apache HTTP Server 785:a unique string, such as 1040:. "Query" (section 3.4). 970:Common Gateway Interface 916:414 Request-URI Too Long 791: 724: 538: 1172:"HTML/Elements/isindex" 1054:Forms in HTML documents 912: 469:) and the characters ' 326: 187: 107: 79: 47: 43:with the query string 908: 854:foo.html?e0a72cb2a2c7 434:SPACE is encoded as ' 256:This convention is a 145:<img ismap> 133:server-side image map 30: 1129:"4.10 Forms — HTML5" 898:Compatibility issues 767:"bar.html" 739:"foo.html" 693:environment variable 276:as query separator. 268:separators to allow 224:anymore, see below). 24:multimedia content. 860:and sends the page 1215:encoding algorithm 918:HTTP status code. 634:"submit" 616:"second" 532:is embedded in an 48: 1154:"<isindex>" 949:URI normalization 902:According to the 589:"first" 536:page as follows: 491:is encoded by %2B 139:attribute on the 1270: 1242: 1236: 1230: 1224: 1218: 1208: 1202: 1201: 1199: 1197: 1186: 1180: 1179: 1168: 1162: 1161: 1150: 1144: 1139: 1133: 1132: 1125: 1119: 1113: 1107: 1106: 1104: 1103: 1088: 1082: 1081: 1079: 1078: 1063: 1057: 1051: 1042: 1041: 1033: 1027: 1026: 1018: 965:Click identifier 933: 932:LimitRequestBody 870: 863: 859: 855: 848: 845: 842: 838: 835: 832: 829: 826: 823: 820: 817: 814: 810: 807: 804: 801: 798: 795: 788: 781: 778: 775: 771: 768: 765: 762: 759: 756: 753: 750: 747: 743: 740: 737: 734: 731: 728: 698: 676: 669: 662: 658: 647: 644: 641: 638: 635: 632: 629: 626: 623: 620: 617: 614: 611: 608: 607:"text" 605: 602: 599: 596: 593: 590: 587: 584: 581: 580:"text" 578: 575: 572: 569: 566: 563: 560: 557: 554: 551: 548: 545: 542: 519: 512: 508: 497: 490: 485:' are left as-is 484: 480: 476: 472: 468: 464: 460: 456: 452: 448: 441: 437: 417: 413: 405: 397: 386:Percent-encoding 375: 359: 355: 347: 339: 324: 314: 306: 252: 235: 219: 211: 200: 185: 178: 174: 170: 153: 146: 143:element with an 142: 138: 127: 105: 98: 84: 77: 46: 1280: 1279: 1273: 1272: 1271: 1269: 1268: 1267: 1248: 1247: 1246: 1245: 1237: 1233: 1225: 1221: 1209: 1205: 1195: 1193: 1188: 1187: 1183: 1170: 1169: 1165: 1152: 1151: 1147: 1140: 1136: 1127: 1126: 1122: 1114: 1110: 1101: 1099: 1090: 1089: 1085: 1076: 1074: 1071:docs.oracle.com 1065: 1064: 1060: 1052: 1045: 1035: 1034: 1030: 1020: 1019: 1015: 1010: 940: 931: 906:specification: 900: 868: 861: 857: 853: 850: 849: 846: 843: 840: 836: 833: 830: 827: 824: 821: 818: 815: 812: 808: 805: 802: 799: 796: 793: 786: 783: 782: 779: 776: 773: 769: 766: 763: 760: 757: 754: 751: 748: 745: 741: 738: 735: 732: 729: 726: 705: 696: 674: 667: 660: 656: 649: 648: 645: 642: 639: 636: 633: 630: 627: 624: 621: 618: 615: 612: 609: 606: 603: 600: 597: 594: 591: 588: 585: 582: 579: 576: 573: 570: 567: 564: 562:"get" 561: 558: 555: 552: 549: 546: 543: 540: 526: 517: 510: 506: 495: 488: 482: 478: 474: 470: 466: 462: 458: 454: 450: 446: 439: 435: 415: 411: 403: 395: 388: 382: 373: 357: 353: 346:<isindex> 337: 322: 305:<isindex> 297: 251: 247: 244: 233: 217: 209: 198: 183: 176: 172: 168: 161: 152:<isindex> 103: 96: 82: 75: 69: 44: 17: 12: 11: 5: 1278: 1277: 1274: 1266: 1265: 1260: 1250: 1249: 1244: 1243: 1231: 1219: 1203: 1181: 1163: 1145: 1134: 1120: 1108: 1096:Stack Overflow 1083: 1058: 1043: 1028: 1012: 1011: 1009: 1006: 1005: 1004: 999: 997:UTM parameters 994: 989: 984: 978: 973: 967: 962: 957: 951: 946: 939: 936: 899: 896: 895: 894: 890: 887: 884: 839:mine is better 792: 772:mine is better 725: 704: 701: 539: 525: 522: 503: 502: 492: 486: 443: 432: 384:Main article: 381: 378: 342: 341: 330: 296: 295:Indexed search 293: 249: 245: 230:web frameworks 226: 225: 202: 191: 160: 157: 156: 155: 148: 129: 89:Web frameworks 68: 65: 15: 13: 10: 9: 6: 4: 3: 2: 1276: 1275: 1264: 1261: 1259: 1256: 1255: 1253: 1240: 1235: 1232: 1228: 1223: 1220: 1216: 1214: 1207: 1204: 1191: 1185: 1182: 1177: 1173: 1167: 1164: 1159: 1155: 1149: 1146: 1142: 1138: 1135: 1130: 1124: 1121: 1117: 1112: 1109: 1097: 1093: 1087: 1084: 1072: 1068: 1062: 1059: 1055: 1050: 1048: 1044: 1039: 1032: 1029: 1024: 1017: 1014: 1007: 1003: 1000: 998: 995: 993: 990: 988: 987:Semantic URLs 985: 982: 979: 977: 974: 971: 968: 966: 963: 961: 958: 955: 952: 950: 947: 945: 942: 941: 937: 935: 928: 924: 919: 917: 911: 907: 905: 897: 891: 888: 885: 881: 880: 879: 876: 874: 865: 790: 723: 720: 718: 713: 711: 702: 700: 694: 690: 687: 683: 678: 672: 665: 654: 537: 535: 531: 523: 521: 514: 500: 493: 487: 444: 433: 431: 427: 426: 425: 423: 419: 409: 401: 393: 387: 379: 377: 371: 367: 363: 351: 335: 331: 328: 327: 325: 319: 316: 310: 302: 294: 292: 290: 286: 282: 277: 275: 271: 267: 263: 259: 254: 242: 237: 231: 223: 215: 207: 203: 196: 192: 189: 188: 186: 180: 166: 158: 149: 134: 130: 123: 119: 118: 117: 115: 110: 106: 100: 94: 90: 86: 78: 72: 66: 64: 61: 58:based on the 57: 53: 42: 38: 37:Google Chrome 34: 29: 25: 22: 1234: 1222: 1212: 1206: 1194:. Retrieved 1184: 1175: 1166: 1157: 1148: 1137: 1123: 1111: 1100:. Retrieved 1098:. 2013-06-09 1095: 1086: 1075:. Retrieved 1073:. 2011-02-10 1070: 1061: 1031: 1016: 944:URI fragment 920: 913: 909: 901: 877: 869:e0a72cb2a2c7 866: 851: 811:see my page! 787:e0a72cb2a2c7 784: 744:see my page! 721: 717:HTTP cookies 714: 706: 697:QUERY_STRING 679: 650: 527: 515: 504: 461:), numbers ( 420: 408:URL encoding 389: 380:URL encoding 343: 321: 317: 298: 289:HTTP request 278: 255: 238: 227: 182: 162: 147:construction 111: 108: 102: 87: 80: 74: 70: 49: 21:query string 20: 18: 1192:. W3Schools 976:HTTP cookie 925:instead of 893:experience. 873:web beacons 653:text fields 499:hexadecimal 370:equals sign 344:Though the 195:equals sign 141:<img> 83:name=ferret 56:file system 33:address bar 1252:Categories 1102:2013-09-08 1077:2013-09-08 1038:"RFC 3986" 1023:"RFC 3986" 1008:References 1002:Web beacon 992:URI scheme 392:characters 214:semicolons 39:showing a 960:Clean URL 710:log files 664:attribute 445:Letters ( 350:plus sign 334:plus sign 274:ampersand 266:ampersand 262:semicolon 239:For each 206:ampersand 165:HTML form 159:Web forms 122:HTML form 93:ampersand 67:Structure 1176:W3C Wiki 938:See also 862:foo.html 703:Tracking 657:test.cgi 400:fragment 135:via the 124:via the 671:element 666:of the 524:Example 481:' and ' 364:(e.g., 299:Before 154:element 128:element 1196:May 1, 983:(HTTP) 695:named 689:script 682:server 661:action 556:method 547:action 438:' or ' 422:HTML 5 414:' or " 366:Apache 313:action 177:field3 173:field2 169:field1 972:(CGI) 841:</ 813:</ 774:</ 746:</ 684:by a 640:</ 637:/> 625:input 619:/> 598:input 592:/> 571:input 528:If a 390:Some 301:forms 250:value 246:field 241:field 210:& 137:ismap 97:& 1210:The 1198:2013 923:POST 904:HTTP 883:URL. 847:> 837:> 828:href 822:< 819:> 809:> 800:href 794:< 780:> 770:> 761:href 755:< 752:> 742:> 733:href 727:< 668:form 646:> 643:form 628:type 622:< 610:name 601:type 595:< 583:name 574:type 568:< 565:> 544:form 541:< 534:HTML 530:form 453:and 285:POST 114:HTML 1258:URL 954:URL 927:GET 686:CGI 513:". 511:%7E 496:%HH 477:',' 473:',' 440:%20 418:". 416:%20 372:, ' 362:CGI 358:%20 352:, ' 336:, ' 309:GET 281:GET 258:W3C 236:). 222:W3C 212:" ( 208:, " 197:, " 120:an 99:": 95:, " 60:URL 41:URL 35:on 31:An 1254:: 1174:. 1156:. 1094:. 1069:. 1046:^ 875:. 712:. 699:. 677:. 340:'. 201:". 175:, 171:, 131:a 19:A 1200:. 1178:. 1160:. 1131:. 1105:. 1080:. 858:? 844:a 831:= 825:a 816:a 803:= 797:a 777:a 764:= 758:a 749:a 736:= 730:a 631:= 613:= 604:= 586:= 577:= 559:= 550:= 518:+ 507:~ 489:+ 483:_ 479:. 475:- 471:~ 467:9 465:– 463:0 459:z 457:– 455:a 451:Z 449:– 447:A 442:' 436:+ 412:+ 404:= 396:# 374:= 354:+ 338:+ 248:= 218:; 216:" 199:=

Index


address bar
Google Chrome
URL
Hypertext Transfer Protocol
file system
URL
Web frameworks
ampersand
HTML
HTML form
server-side image map
HTML form
equals sign
ampersand
semicolons
W3C
web frameworks
field
W3C
semicolon
ampersand
application/x-www-form-urlencoded
ampersand
GET
POST
HTTP request
forms
GET
plus sign

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.