From 5be4ba1222e1b9e600fc2d22462a9db021b8b283 Mon Sep 17 00:00:00 2001 From: thomasmars Date: Mon, 30 Jul 2018 14:28:02 +0200 Subject: [PATCH] JI-781 Support regex in core for when CORS attributes is set --- js/h5p.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index a5bc3c5..f10df8f 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -2040,8 +2040,11 @@ H5P.createTitle = function (rawTitle, maxLength) { * @returns {string|null} Returns the string that should be set as crossorigin policy for elements or null if * no policy is set. */ - H5P.getCrossOrigin = function () { - return H5PIntegration.crossorigin ? H5PIntegration.crossorigin : null; + H5P.getCrossOrigin = function (url) { + var crossorigin = H5PIntegration.crossorigin; + var urlRegex = H5PIntegration.crossoriginRegex; + + return crossorigin && urlRegex && url.match(urlRegex) ? crossorigin : null; }; /**