Problem embedding H5P content from Wordpress into another website

giofonseca's picture

Hi there,

I would be really happy if someone can help me to figure out why I am not able to embed the following Iframe code in other websites. I created that H5P content using the WordPress plugin.

<iframe src="https://giovanni-fonseca.com/wp-admin/admin-ajax.php?action=h5p_embed&id=1" width="958" height="600" frameborder="0" allowfullscreen="allowfullscreen"></iframe><script src="https://giovanni-fonseca.com/wp-content/plugins/h5p/h5p-php-library/js/h..." charset="UTF-8"></script>

Thanks in advance for your help!

Best regards,

Giovanni

otacke's picture

Hi giofonseca!

Your question is answered in your browser's developer console (usually opened by pressing F12) ;-)

Cheers,
Oliver

giofonseca's picture

Is always nice to learn something new!

What I have researched about X-frame-options at the moment disturbs me a bit, because it seems there is not a way to embed the content from my WordPress into another website, which is exactly what I am looking for in order to not use h5p.org as a hosting service. Specifically I am interested to embed H5P content into Genially presentations.

Is there another option that I have not found to make that work or Drupal or Moodle let make that job?

Any help will be very appreciated!

Best regards,

Giovanni

otacke's picture

Hi giofonseca!

You need to change the X-frame header/Content-Security-Policy header on your server, cmp. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options (although allow-from uri is obsolete) and https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors. If you can't access the server config directly, setting the parameters in a .htaccess file inside the top WordPress folder should work as well.

Cheers,
Oliver

giofonseca's picture

Hi Oliver! 

Thank you very much for your advice, that fixed the problem and now I won't depend on h5p.org anymore to host my H5P content.

Thanks again for the great work you are doing!

Best regards,

Giovanni

otacke's picture

Hi giofonseca!

Thanks for letting me know. And kudos for figuring out the details yourself!

Best,
Oliver

Hey, can you show me how'd you fix the issue? I want to be able to embed from my wordpress too.