HFP-3008 Add content language to iframe document
parent
16c71b444b
commit
1a644dda11
|
@ -378,8 +378,11 @@ H5P.init = function (target) {
|
||||||
// Insert H5Ps that should be in iframes.
|
// Insert H5Ps that should be in iframes.
|
||||||
H5P.jQuery('iframe.h5p-iframe:not(.h5p-initialized)', target).each(function () {
|
H5P.jQuery('iframe.h5p-iframe:not(.h5p-initialized)', target).each(function () {
|
||||||
var contentId = H5P.jQuery(this).addClass('h5p-initialized').data('content-id');
|
var contentId = H5P.jQuery(this).addClass('h5p-initialized').data('content-id');
|
||||||
|
const contentData = H5PIntegration.contents['cid-' + contentId];
|
||||||
|
const language = contentData && contentData.metadata && contentData.metadata.defaultLanguage
|
||||||
|
? contentData.metadata.defaultLanguage : 'en';
|
||||||
this.contentDocument.open();
|
this.contentDocument.open();
|
||||||
this.contentDocument.write('<!doctype html><html class="h5p-iframe"><head>' + H5P.getHeadTags(contentId) + '</head><body><div class="h5p-content" data-content-id="' + contentId + '"/></body></html>');
|
this.contentDocument.write('<!doctype html><html class="h5p-iframe" lang="' + language + '"><head>' + H5P.getHeadTags(contentId) + '</head><body><div class="h5p-content" data-content-id="' + contentId + '"/></body></html>');
|
||||||
this.contentDocument.close();
|
this.contentDocument.close();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue