Skip to content

Commit b483a76

Browse files
authoredJul 22, 2021
fix: don't add anchor to DOM for getAbsoluteURL (#7336)
1 parent b3acf66 commit b483a76

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed
 

‎src/js/utils/url.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,12 @@ export const getAbsoluteURL = function(url) {
9797
// Check if absolute URL
9898
if (!url.match(/^https?:\/\//)) {
9999
// Convert to absolute URL. Flash hosted off-site needs an absolute URL.
100-
const div = document.createElement('div');
100+
// add the url to an anchor and let the browser parse the URL
101+
const a = document.createElement('a');
101102

102-
div.innerHTML = `<a href="${url}">x</a>`;
103-
url = div.firstChild.href;
103+
a.href = url;
104+
105+
url = a.href;
104106
}
105107

106108
return url;

0 commit comments

Comments
 (0)
Please sign in to comment.