Is this link valid?
<a href="?lang=en">eng</a>
I know the browsers treat it as expected and I know the empty link would be ok too – but is it ok to specify just the parameters?
I am curious because question mark (“?”) is only a convention by most HTTP servers (AFAIK), though I admit it is a prevailing one.
So, to recap:
-
will all browsers interpret this correctly?
-
is this in RFC?
-
can I expect some trouble using this?
UPDATE: the intended action on click is to redirect to the same page, but with different GET parameters (“lang=en” in above example).
Yes, it is.
You can find it in RFC 1808 – Relative Uniform Resource Locators:
RFC 3986 – Uniform Resource Identifier (URI): Generic Syntax restates the same, and adds more details, including the grammar:
Now, that is not to say all browsers implement it according to the standard, but it looks like this should be safe.