You are currently viewing the new Beta Editor Docs.
Switch to the Classic Editor Docs
You are currently viewing the Classic Editor Docs.
Switch to the Beta Editor Docs

Embedding Your App in a Web Page

In the Publish dialog, you can choose whether to allow embedding of your app into other web pages.

The Publish dialog with the 'Embed my app in a web page' box checked and the relevant Iframe code hint shown.

If embedding is disabled, your app will be served with the X-Frame-Options: deny header, and browsers will refuse to load your app if it is embedded inside another page.

Running your app in an IFrame

If embedding is enabled, you see an HTML snippet you can copy and paste into any page.

<script src="" async></script>
<iframe style="width:100%" data-anvil-embed src=""></iframe>

The <script> tag automatically resizes the <iframe> to fit the vertical space used by your apps. If you omit the <script> tag entirely, your apps will still load, but the <iframe> will no longer automatically resize.

Embedding Multiple Apps

You can embed multiple apps into one page using multiple <iframe>s with different src URLs. If you are embedding multiple apps into one page, you only need to include the <script> tag once.

<!-- Include the Anvil script that handles automatic vertical resizing of the IFrame -->
<script src="" async></script>

<!-- Embed one app -->
<iframe style="width:100%" data-anvil-embed src=""></iframe>

<!-- Embed another app -->
<iframe style="width:100%" data-anvil-embed src=""></iframe>