Bing Zhao
Bing Zhao

Reputation: 608

How does a URL with multiple question marks work?

https://www.airbnb.com/help?audience=host?audience=guest?audience=host?audience=host?audience=host

The URL above was created occasionally by me.

A normal URL to me has one question mark while all parameters are distinct. So in my opinion, this URL is abnormal.

What seems weird to me is that it still works and my browser has no complaint about it.

Would anyone explain it to me?

Upvotes: 1

Views: 2144

Answers (1)

unor
unor

Reputation: 96507

The first ? indicates the query component. The query component is terminated by the first following #, or the end of the URL.

So, this is the query component of your URL:

audience=host?audience=guest?audience=host?audience=host?audience=host

Within the query component, it’s perfectly fine to use ? characters, they don’t have any special meaning there (list of all allowed characters in the query).

While parameters in the query typically are in the name=value format, separated by &, this is just a convention (it’s what the encoding type application/x-www-form-urlencoded in HTML forms produces). Site authors can use whatever format they want.

Upvotes: 3

Related Questions