Custom HTML block API

Custom HTML block allows you to insert executable HTML and JavaScript directly into Stonly content. With that, you can customize layout, integrate other tools, and build small web apps (quizzes, calculators, forms etc.) to be included in guides and articles.

We expose a simple API called STON that lets you access guide and session data, like guide ID or local variables. The API is documented in this guide.

STON API: limitations

The Custom HTML block is rendered in the browser as an iframe with the sandbox attribute set to: allow-scripts, allow-forms, allow-modals, allow-popups , allow-presentation, allow-top-navigation-by-user-activation, allow-downloads. There is no allow-same-origin, however. This means you can run JavaScript in it but the sandboxing imposes certain limitations:

  • No direct access to Stonly parent DOM.

  • No access to parent cookies or parent local/session storage context.

  • No support for device access and privileged browser features (e.g. camera/mic via getUserMedia).

  • Top-level page navigation is allowed only after a direct user action (e.g. a click).