JI-781 Support regex in core for when CORS attributes is set

pull/53/head
thomasmars 2018-07-30 14:28:02 +02:00
parent a55379adcf
commit 5be4ba1222
1 changed files with 5 additions and 2 deletions

View File

@ -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;
};
/**