Skip to content

Commit

Permalink
fix: don't add anchor to DOM for getAbsoluteURL (#7336)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatsev committed Jul 22, 2021
1 parent b3acf66 commit b483a76
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/js/utils/url.js
Expand Up @@ -97,10 +97,12 @@ export const getAbsoluteURL = function(url) {
// Check if absolute URL
if (!url.match(/^https?:\/\//)) {
// Convert to absolute URL. Flash hosted off-site needs an absolute URL.
const div = document.createElement('div');
// add the url to an anchor and let the browser parse the URL
const a = document.createElement('a');

div.innerHTML = `<a href="${url}">x</a>`;
url = div.firstChild.href;
a.href = url;

url = a.href;
}

return url;
Expand Down

0 comments on commit b483a76

Please sign in to comment.