http://example.com/test.php
(does not need to be PHP)
<pre>
<?=htmlspecialchars($_SERVER['REQUEST_URI']);?>
<a href="?foo=bar">?foo=bar</a>
<a href="?fizz=buzz">?fizz=buzz</a>
</pre>
At this time, any user agent you have (Chrome 41, w3m/0.5.3, GNU Wget 1.13.4) expands the link as follows:
"?foo=bar"
=>http://example.com/test.php?foo=bar
"?fizz=buzz"
=>http://example.com/test.php?fizz=buzz
Is there any support from HTML or related standards for this behavior?Or is it just a user agent implementation practice?
html
RFC 3986 Uniform Resource Identifier (URI): Generic Syntax. (RFC3986 Japanese translation)
The algorithm for resolving relative URIs is found in 55.2.Relative Resolution に.Also, the actual example is in "5.4. Reference Resolution Examples", so I'll skip it.
Within a presentation with a well defined base URI of
http://a/b/c/d;p?q
a relative reference is transformed to its target URI as follows.
"?y" = "http://a/b/c/d;p?y"
"g?y" = "http://a/b/c/g?y"
Therefore, each user agent behaves according to the specifications of RFC 3986.
© 2023 OneMinuteCode. All rights reserved.