Tuesday, 19 November 2013

Javascript: Get the current root url

This may not be the easiest way, but is certainly worked for me.

var url = $(location).attr('href').replace(window.location.pathname, '').replace(window.location.search, '');

No comments:

Post a comment