Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moodle-Plugin mod_hvp produced embed code not detected by h5p-resizer.js #178

Open
danowar2k opened this issue Apr 18, 2024 · 0 comments
Open

Comments

@danowar2k
Copy link

Hi. Moodle produces the following code for embedding:

<iframe src="BASEURL/mod/hvp/embed.php?id=5251" width="760" height="453" frameborder="0" allowfullscreen="allowfullscreen" title="Embed Test"></iframe><script src="BASEURL/mod/hvp/library/js/h5p-resizer.js" charset="UTF-8"></script>

The h5p-resizer.js (https://github.com/h5p/h5p-php-library/blob/master/js/h5p-resizer.js) has the following code at the end:

// Let h5p iframes know we're ready!
  var iframes = document.getElementsByTagName('iframe');
  var ready = {
    context: 'h5p',
    action: 'ready'
  };
  for (var i = 0; i < iframes.length; i++) {
    if (iframes[i].src.indexOf('h5p') !== -1) {
      iframes[i].contentWindow.postMessage(ready, '*');
    }
  }

Every embed iframe Moodle produces does not (!) have h5p in the src attribute, but hvp. So the resizer never tells any iframe it's ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant