Fixed an issue with link calculation
This commit is contained in:
parent
02aa0891cb
commit
2bc53528d0
@ -11,6 +11,7 @@
|
||||
const queryString = window.location.search;
|
||||
const queryLoc = window.location.origin;
|
||||
const queryRequest = window.location.href.split('?')[0];
|
||||
const windowLoc = window.location.toString();
|
||||
console.log(queryString);
|
||||
const urlParams = new URLSearchParams(queryString);
|
||||
const requestURL = urlParams.get('url')
|
||||
@ -38,7 +39,7 @@
|
||||
// Replace either http://<somehost>/<somedoc> or http://<somehost> with "" so that:
|
||||
// 1.) links to elements on the same page work
|
||||
// 2.) disable cross-origin requests
|
||||
var fixedURL = hlinks[i].href.replace(window.location, "").replace(queryLoc, "")
|
||||
var fixedURL = hlinks[i].href.replace(windowLoc.split('#')[0], "").replace(queryLoc, "")
|
||||
// If the remaining character is the hash, this is a same-page section link
|
||||
if (fixedURL.startsWith("#")) {
|
||||
fixedURL = requestURL + fixedURL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user