From 72db596bac97c8755e015447c051c1453fefd51d Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Tue, 10 Mar 2015 09:53:33 +0100 Subject: [PATCH] Make sure H5P.externalEmbed is set inside the iframe. Run H5P.init from external resource to ensure correct execution order in IE9. --- js/h5p.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index 7ed4074..9a08a7a 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -215,8 +215,6 @@ H5P.init = function () { // Insert H5Ps that should be in iframes. H5P.jQuery("iframe.h5p-iframe").each(function () { var contentId = H5P.jQuery(this).data('content-id'); - this.contentWindow.H5P = this.contentWindow.H5P || {}; - this.contentWindow.H5P.externalEmbed = false; this.contentDocument.open(); this.contentDocument.write('' + H5P.getHeadTags(contentId) + '
'); this.contentDocument.close(); @@ -261,7 +259,7 @@ H5P.getHeadTags = function (contentId) { createStyleTags(H5PIntegration.contents['cid-' + contentId].styles) + createScriptTags(H5PIntegration.core.scripts) + createScriptTags(H5PIntegration.contents['cid-' + contentId].scripts) + - ''; + ''; }; H5P.communicator = (function () { @@ -1387,3 +1385,11 @@ H5P.on = function(instance, eventType, handler) { instance.$.on(eventType, handler); } }; + + +H5P.jQuery(document).ready(function () { + if (!H5P.preventInit) { + // Start script need to be an external resource to load in correct order for IE9. + H5P.init(); + } +});