Closed debopamsengupta closed 6 years ago
You can add a crossorigin property to each script using the before
callback:
loadjs(['/path/to/foo.js', '/path/to/bar.js'], {
success: function() {},
error: function(pathsNotFound) {},
before: function(path, scriptEl) {
/* called for each script node before being embedded */
if (path === '/path/to/foo.js') scriptEl.crossOrigin = true;
}
});
(See example 14 here: https://github.com/muicss/loadjs)
awesome thanks :)
Hello :) would it be possible to add support for adding a crossorigin property to scripts being loaded using
loadjs
.This is mainly because if these scripts end up having errors, consumers of such scripts only end up with non-descriptive
Script error.
messages.I'd be happy to make a PR with this feature.