In the past I have often used the jquery.urls plugin. However, nowadays this seems quite popular (https://github.com/allmarkedup/purl ). If you don't want to add an extra dependency I am fine with the current implementation.