Toran Billups Toran Billups - 7 months ago 27
jQuery Question

Does jQuery have a built in function to return the rootURL?

I typically use the below function to return the root URL if I ever need this, but thought to ask if jQuery had a "one liner" way to do this ...

function getRootURL()
var baseURL = location.href;
var rootURL = baseURL.substring(0, baseURL.indexOf('/', 7));

// if the root url is localhost, don't add the directory as cassani doesn't use it
if (baseURL.indexOf('localhost') == -1)
return rootURL + "/AppName/";
} else {
return rootURL + "/";


What about