document is not defined

Hi,

You can simply add a HTML component and add your code to it instead of creating an iframe using code.
Moreover, I recommend checking out the following articles:

Regards,
Tal.