I'm writing a single page web application that talks to a business layer via asynchronous RPC (encoded with json). I'm targeting fairly modern browsers, so I can at minimum control the URL after the hash. However, the URL won't really be what drives the application's state (that will be maintained by a javascript model layer), so I don't have to do anything with it. I could even keep it the same the whole time without any implementation problem.

The question is, what should go in the URL? I won't go into the application because I'm hoping the question is generally useful. What kinds of expectations do users have about backward and forward buttons? About typing in a URL? Are there currently any generally applicable best practices yet for this kind of application?

  • 1
    Anything you want to bookmark, anything you want to copy a link to, anything you want to save or share. An URL identifies a resource. Think what your users want to share and save.
    – Raynos
    Commented Aug 25, 2011 at 2:27
  • "Share and save" might be the best answer I've gotten so far. I don't think users think of a URL as meaning a resource (yes, I know the acronym, but few users do), but share and save (though debatably equivalent to "resource") would make sense.
    – psr
    Commented Aug 29, 2011 at 20:36

2 Answers 2


The URL should be used for what it does: locating a resource.

You should put in the URL only things relative to the location of the resource, so users will be able to always find it (bookmark, permalink). With this in mind, you should avoid to insert variables in it or other custom data.

Just look at the link of this question for example, and how easy it is to share between social networks.

You should also consider that many users (like me) may prefer to navigate your site directly from the URL bar. For example playing with numbers. If I'm reading a blog article with a URL containing a folder named 2011, I could try to remove all the URL part up to the year folder, expecting to see a page which contains all the 2011 articles.

Then I could also change 2011 to 2010 to browser last year articles, and so on...

Too often websites provides very basic (and sometimes inefficient or completely absent) navigation commands. It's often easier to navigate a website directly via the URL bar.


I would also like to add that the URL should describe as much as possible what is the content of the linked resource, using clear keywords, not random numbers or misleading/useless words.

  • I think the idea of a resource gets a little funky in a web application, though it depends on the application. Imagine a web version of Word or Excel. The documents make reasonable resources, but within a document? You use the words "site", "website", "content", and "resource", which apply more to websites than web applications. Yet if there is a URL bar, users will presumably think some behaviors more reasonable than others. Certainly clear keywords is a good suggestion.
    – psr
    Commented Aug 25, 2011 at 16:32

One of the interfaces of web applications, is URL (address bar). It can be considered a counterpart to API (application programming interface) in the same facet that some of the behaviors of the application can be controlled directly from the URL. For example, you may directly type http://www.yoursite.com/update/john/phone-number-to/9195527768. This way, you can controls your web application directly from address bar and address bar becomes something similar to command line, and URL becomes a command.

Another usage of the URL as others said can be bookmarking. You may remember Back button problem of AJAX applications. It prevented users from being able too bookmark one specific state (or page, or resource) of a website. For example, consider that your site is http://www.yoursite.com. No matter how much your site's visitor interacts with it, he still sees http://www.yoursite.com. How the heck he/she is supposed to get a link to one specific resource of your site and send it to his/her friend? Via Firebug?

Also if you don't change the URL while changing the state of your application, no entry would be added to window.history object, thus if user click Back button, instead of being taken to the previous state of your site (or application), he/she would be taken to the previous domain (maybe google.com, maybe yahoo.com, any domain, but not yours). This is a seriously frustrating experience. Paralle Plesk's control panel works just like what you describe here, and it's awful.

Another usage of URL would be SEO (search engine optimization). Google, Yahoo, and Bing would know and index your site's content based on the URLs you submit to them. One URL, one index, less chance to be found on the net.

I strongly recommend that you redesign your work. No offense, but when we say best practice, we mean something that has been done by many people and organizations. What you want to do is so rare that I can't remember any example of such an application. Best practice comes from repeated implementation of something. I believe that there is no best practice for this architecture.

  • The technical issues with the back button have been solved (see backbone.js or sammy.js, for relatively simple examples), so I can put anything I want in the address bar anytime(at least after the "#" character). The question is what I ought to put.
    – psr
    Commented Aug 25, 2011 at 16:20
  • I forgot to say that you may very well be correct about there not being a best practice. But I don't know until I ask. Also, as far as SEO, absolutely not an issue for me. This is a private enterprise application and people would prefer it NOT show up on search engines, which won't be able to access it anyway. But if you need SEO this architecture does make it tough (I believe there are ways to fake it, but it's enough work to make you think twice. I haven't pursued it because it's not my problem).
    – psr
    Commented Aug 25, 2011 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.