diff --git a/themes/bootstrap3/js/common.js b/themes/bootstrap3/js/common.js index a0b93c1628f2de83ce9bf807e9bf08bec33dc6a2..4860cfd4266c29935022b6f03d740589ce9ed203 100644 --- a/themes/bootstrap3/js/common.js +++ b/themes/bootstrap3/js/common.js @@ -163,13 +163,16 @@ function getUrlRoot(url) { var urlroot = null; var urlParts = url.split(/[?#]/); var urlWithoutFragment = urlParts[0]; + var slashSlash = urlWithoutFragment.indexOf('//'); if (VuFind.path === '' || VuFind.path === '/') { // special case -- VuFind installed at site root: var chunks = urlWithoutFragment.split('/'); - urlroot = '/' + chunks[1] + '/' + chunks[2]; + // We need to extract different offsets if this is a full vs. relative URL: + urlroot = slashSlash > -1 + ? ('/' + chunks[3] + '/' + chunks[4]) + : ('/' + chunks[1] + '/' + chunks[2]); } else { // standard case -- VuFind has its own path under site: - var slashSlash = urlWithoutFragment.indexOf('//'); var pathInUrl = slashSlash > -1 ? urlWithoutFragment.indexOf(VuFind.path, slashSlash + 2) : urlWithoutFragment.indexOf(VuFind.path);