What is #/products/toaster - The origin of the URL Hash

This post is historical, and exaggerated to emphasize points. It is not historically accurate, and it's tone is intentionally light, so that the subject matter is easier to absorb.

In the beginning, there was the internet

Every website was a single webpage.  They were horrifying geocities nightmares, like this.


The internet was a treacherous place, and the Back button had one purpose, to escape something you never wanted to see in the first place.  But the .com boom happened, and every company wanted a webpage.  It became immediately apparent that a single page wasn't enough. So...

Routing was born

Routing initially meant that you could link to any folder in the file tree that contained your website.  If you had a Tools folder inside of the folder with your website, then you could reach it on the web by adding /Tools to the URL.


The default page configuration was born.  When you go to a folder, the website would try to open the default page (usually index.html or default.aspx) even if you didn't specify the file name in the URL.  Of course, you could browse to specific files in the file system as well.  Developers used this to manage the location of javascript and css files and the world of geocities was no more.  It was replaced by the world of PHP.  Everyone with a computer could suddenly host a website, and it was...better than it was before.  At least, the Back button had a purpose.  Companies would allow you to browse their websites now, with multiple pages, and you could go back to different parts of the website and look at neat things.  The users got used to this feature and liked using the Back button to go back if they didn't want to be somewhere (like the buy now page).

Routing grew up

Routing was all well and good, but there was this concept of clean code in programming that this file structure based routing ignored.  So we finally got around to implementing a concept that some guy created in like the 70s.  Ruby on Rails showed us how to use MVC (if you're new to web development, Model View Controller is a pattern for organizing code).


Suddenly, routing wasn't just based on your file structure.  Developers had a routing engine they could play with.  They could directly point you to different files, or even different functions via Routing.  They began to generate webpages on the fly, and the web application was born--er, well made better.  Suddenly you found cool pages like amazon.com/products/1234 and websites had thousands of pages because each page was generated as you needed it.  And the internet was a happy place.  Users could now send links to their favorite stuff to their colleagues, directly.  The internet was easier to find your way around!  The routing engine was born--er, enhanced--er, made more clear & explicit.  Whatever, the point is web programmers started using Routing Engines in their code.

Microsoft fixed the internet

Somewhere along the way, it was decided that the internet was ugly, and slow.  People would try to upload a 9000 hour YouTube video and complain that they had to wait while it uploaded.  Waiting?  That's not the way things should work in 1995.  So Microsoft started trying new things.  In 1996 they created frames (god help us) and more important, in 1998 they created a Javascript feature that we now call AJAX.


AJAX created this world where you could click a button and the webpage didn't refresh.  Instead, the data was transmitted behind the scenes, and you were able to keep doing other stuff on the website.  AJAX truly changed the internet.  The internet was starting to look like the applications users ran on their desktops, and people were happy.

But that's not good enough!

Software developers are always trying to make things better.  In the early 21st century some super smart over-eager developers decided it was time to improve the internet.  Sure, you could implement some of your website in AJAX, but why not all of it?  What if your website never had to load a new webpage at all?  Was this a good idea?  WHO CARES!


The Single Page Application was born.  They would implement an entire website in AJAX, and the user would only see one page and click around it.  To the users, the difference was negligible.

Except it was broken

Broken you say?  Nonsense!  Very smart people created this.  It works flawlessly.  People explained that the simple features they'd come to expect from websites did not exist anymore.  When they clicked the Back button, it took them out of the app entirely, instead of going back to the previous section where they were working.  When they sent the link to their friends, it brought their friends to the home page, rather than the specific section where they were working, so it was confusing.  The internet was broken!  The users were confused by these new Single Page Applications.  Developers were forced to fix it.

The URL Hash was born

Well, actually, developers had known about it for years.  In the URL, you can directly navigate around the page using the # hash tag.  In fact, it's been used on FAQs quite a bit to link to the answer that's already on the page so that you don't have to scroll down.  What was neat about this feature, is by including it in the URL, you could send a user directly to that part of the page.  The website was able to read from this tag and do stuff. COOL!


*cough* I mean Hash tag Routing was born

So a bunch of guys got together and decided to take the URL Hash, and build a Routing Engine for it!  And (after some attempts) frameworks like Sammy.js were born.

The URL hash could be used to send users to sections of the Single Page Applications, just like they were used to the rest of the URL sending them to different parts of the Website.  The Back button would take them to the previous hash, so they would be moving around the app like they expected, and not completely dropped out of it.  And they could link their friends to the neat stuff they'd seen.  And the web was happy again.

But the internet didn't end there!

OK, yes the web didn't end at URL Hash Routing Engines.  Some guys improved upon it at Google by making AngularJS and lots of other fancy stuff is continuing to make the web a better (albeit more complex) place.  This is not the end, but just know, that as long as there's capable developers out there, there will always be more stuff being built.  The SPA features have matured, and we've learned to use SPAs sparingly and for some very specific purposes (like posting on this blog).  SPAs also showed that a website should be made up of numerous web applications, instead of being just one, and so the web is still absorbing this new feature and I expect speed bumps to continue.

Comments

Popular Posts