mirror of
https://github.com/alexadam/save-as-ebook.git
synced 2025-09-09 17:04:39 +00:00
fix relative hrefs
This commit is contained in:
parent
e737203bab
commit
36abc53ca0
1 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue