Issues with Google Slides and Javascript

Issues with Google Slides and Javascript

Carolina Blackman -
Erantzun kopurua: 2

Hey there!

I'm having a javasript error when inserting Google Slides in my courses as iframes. When saving the changes and trying to check the files, I got the following error: Your browser does not have JavaScript enabled, so this file cannot be opened. Please enable it and reload the file.

image.png

Have you experienced this type of error?, I'm trying to find solutions, but this is the only iframe type that generates this error.

P.S. Note that debugging doesn't show any error.

Puntuazioen batez bestekoa: -
Carolina Blackman(e)ri erantzunda

Issues with Google Slides and Javascript

Eduardo Kraus -
Particularly helpful Moodlers-ren irudia Plugin developers-ren irudia Testers-ren irudia

Hi, Carolina! How are you? 😊

Based on what you described, the issue might be related to the <iframe> sandbox settings used to embed Google Slides. Google requires specific permissions to work correctly within an iframe, and without them, you’ll encounter this confusing error message. I’ll share a solution I use in my plugin mod_supervideo for displaying Google Drive content, which should also work for your Google Slides. If you’d like to see a practical example, feel free to check out the code I use in mod_supervideo: example link.

In your <iframe> code, you’ll need to add the sandbox attribute with the appropriate permissions. For example:

<iframe  
    src="https://docs.google.com/presentation/d/YOUR_SLIDES_ID/embed"  
    width="100%"  
    height="600"  
    frameborder="0"  
    sandbox="allow-scripts allow-forms allow-same-origin allow-modals">  
</iframe>

These permissions ensure that Google Slides functions properly within the iframe without blocking essential features like JavaScript. 

I hope this helps resolve your issue! If you need further assistance or want to chat more about optimizing Moodle, feel free to reach out. We’re here to help! 💡💻

Eduardo Kraus
Teacher and programmer

Puntuazioen batez bestekoa:Useful (2)
Eduardo Kraus(e)ri erantzunda

Re: Issues with Google Slides and Javascript

Carolina Blackman -
Hi, thanks for the type; I'm going to test it.

I already fix it by changing the Tiny MCE editor for Atto but it is a temporary solution.