1
0
mirror of https://github.com/videojs/video.js.git synced 2025-03-19 21:28:23 +02:00

fix: don't add anchor to DOM for getAbsoluteURL (#7336)

This commit is contained in:
Gary Katsevman 2021-07-22 16:01:12 -04:00 committed by GitHub
parent b3acf66364
commit b483a7613f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;