URI.js is a javascript library for working with URLs. It offers simple, yet powerful ways of working with query string, has a number of URI-normalization functions and converts relative/absolute paths.
Also URI.js provides a jQuery plugin.
Website Demo