fix relative hrefs

This commit is contained in:
alexadam 2016-08-27 12:35:35 +03:00
parent e737203bab
commit 36abc53ca0

View file

@ -70,8 +70,12 @@ function getHref(hrefTxt) {
if (hrefTxt.indexOf('#') === 0) {
hrefTxt = window.location.href + hrefTxt;
}
if (hrefTxt.indexOf('/') === 0) {
hrefTxt = window.location.protocol + '//' + window.location.hostname + hrefTxt;
if (hrefTxt.indexOf('http') !== 0) {
var separator = '/';
if (hrefTxt.indexOf('/') === 0) {
separator = '';
}
hrefTxt = window.location.protocol + '//' + window.location.hostname + separator + hrefTxt;
}
// hrefTxt = escape(hrefTxt);
return hrefTxt;