Fix the combineUrl function

* Allow a url to omit the protocol and use the same protocol as the
* current page
This commit is contained in:
Luís Nabais 2014-02-28 12:39:27 +00:00
parent cab5d7b96f
commit 220a8e4f0e

View File

@ -228,7 +228,11 @@ function combineUrl(baseUrl, url) {
if (url.charAt(0) == '/') {
// absolute path
var i = baseUrl.indexOf('://');
i = baseUrl.indexOf('/', i + 3);
if (url.charAt(1) === '/') {
++i;
} else {
i = baseUrl.indexOf('/', i + 3);
}
return baseUrl.substring(0, i) + url;
} else {
// relative path