0

I came across an unusual URL structure on a site. It looked like this:

https://www.agilealliance.org/glossary/xp/#q=~(infinite~false~filters~(postType~(~'post~'aa_book~'aa_event_session~'aa_experience_report)~tags~(~'xp))~searchTerm~'~sort~false~sortDirection~'asc~page~1)

It seems the category, pagination and sort options of a widget on the page injects and reads through these values. Does this format for storing data in the URL have a name, or is this an esoteric format someone made?

What's the purpose of doing this over using regular GET params, or at least using a more conventional format after the fragment?

Orun
  • 4,383
  • 3
  • 26
  • 44

2 Answers2

1

If you inspect the URL carefully, you'll see that the parameters you describe are placed after the fragment (#), meaning they're not sent to the server but used by the client instead.

In this case, the client (JavaScript) builds them into something like an ElasticSearch query that's then POSTed to the server, in order to update listing you see on your screen.

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
  • Correct, I realize that they're just a custom architecture for a kind of pseudo param via the URL fragment, I just found it strange that someone would do this, and use their own characters as a format (and wondered if the format exists in any other context). I thought Elastic search uses regular params, but I'll take a closer look! – Orun Oct 19 '22 at 13:29
0

Probably the reason those tildes were chosen is because they are one of the very few non-alphanumeric characters that can be used in a URL without needing to be URL encoded (i.e. encoded with a % sign). The others are the hyphen ("-"), underscore ("_"), and period ("."). See What are the safe characters for making URLs?

Since the tilde is the most uncommon of these characters, it is a convenient delimiter for splitting up the queries into their component parts.

Jamie
  • 1
  • 2