logoalt Hacker News

drcongotoday at 7:16 PM4 repliesview on HN

I quite like the semi-colons. I wonder how we ended up with the slightly unwieldy ?foo=bar&some=thing


Replies

pavlovtoday at 7:26 PM

Think “how do I implement a search engine whose interface is visible in the browser address bar?” This was a reasonable question on the early web. And that’s why they are called query params.

The question mark indicates you’re making a query. And the ampersand is a boolean operator. You could imagine query params implementing | in addition to &.

show 1 reply
TRiG_Irelandtoday at 7:59 PM

I'm certain I've seen websites which used semi-colons rather than question marks and ampersands for query parameters. The Jehovah's Witnesses website used to, many years ago. I believe that one of the reasons behind this design was that it meant that there were no special characters which needed to be escaped in HTML. This design works fine for links, but not for forms, which will generate normal URLs containing question marks and ampersands. I suppose you can use POST-Redirect-GET forms, and generate your own URLs using semi-colons.

_micheeetoday at 7:33 PM

Seems Like the recommendation changed from supporting ; and & to only using &.

Thinking about it, it is a little surprising as, if I remember correctly, in HTML source you should encode & as & right?

show 1 reply
ErroneousBoshtoday at 7:35 PM

Is there any reason we couldn't just use that anyway?

show 4 replies