10

I need to control the embedded Google Docs viewer in my site. More specifically I need to be able to enable/disable the controls for Google Slides view and to be able to start/stop the presentation with JavaScript.

I was not able to find any JavaScript API for that, nor I have been able to add my host so my JavaScript to be able to communicate with the iframe content.

Anyone did something like this?

Kos
  • 4,890
  • 9
  • 38
  • 42
Vasil Pavlov
  • 101
  • 4
  • Any updates on this question ? – mosaad Sep 17 '18 at 15:14
  • https://console.developers.google.com/flows/enableapi?apiid=slides.googleapis.com ...would enable the JS API (which works, at least when not embedded with an iFrame). also, with `App Script` there might be a realistic chance, to run code `onOpen()`... while the question does not indicate which controls to disable. – Martin Zeitler Sep 24 '18 at 00:03

1 Answers1

-1

Google Docs doesn't work like that at all. Here are the steps you will need to take.

1: Create Presentation on Google Slides.
   1a: https://docs.google.com/presentation/u/0/
2: Create any scripts you want applied in the script editor.
   2a: https://developers.google.com/apps-script/guides/slides/
3: Publish Presentation. 
   3a: File>Publish to Web>Embed
4: Embed Presentation.
5: Create HTML Function call
6: Create Listener w/ Google Docs (Not on your site.)

If you want your site to be able to access and run scripts from google (Aka, disable controls.) Refer to this link below, it will show you how you can use HTML to request that a script is run from google docs. Keep in mind there is a limitation to daily function calls for free accounts w/ google. I believe it's 5500 calls per day max.

HTML Function Calls: https://developers.google.com/apps-script/guides/html/communication

You also mentioned iFrame, you can find information about that located here.

iFrame Sandboxing: https://developers.google.com/apps-script/migration/iframe