SmartSchema Developer Docs
  1. Embedding & APIs
  2. Modal Embed (iframe)
  • Overview
  • Setup
    • Create an App Credentials
    • Create an Integration
  • Embedding & APIs
    • Launch Endpoint
    • Modal Embed (iframe)
  • Reference
    • Security

On this page

  • Modal Embed (iframe)
    • Note on iframe usage
    • Minimal HTML/JS

Modal Embed (iframe)

You can open the frontend_url directly or inside a modal iframe.

Note on iframe usage

Don’t forget to include the sandbox attribute (sandbox=“allow-scripts allow-top-navigation-by-user-activation”) so the embedded page can redirect the top-level window.

<iframe
  src="FRONTEND_URL"
  width="900"
  height="700"
  sandbox="allow-scripts allow-top-navigation-by-user-activation"
></iframe>

Minimal HTML/JS

<!doctype html>
<html>
<body>
  <button id="open">Open Import</button>

  <div id="backdrop" style="display:none;position:fixed;inset:0;background:rgba(0,0,0,.4);align-items:center;justify-content:center;">
    <div style="background:#fff;position:relative;padding:8px;border-radius:8px;">
      <button onclick="closeModal()" style="position:absolute;top:8px;right:8px;">✕</button>
  <iframe id="lm-frame" width="900" height="700" style="border:0" sandbox="allow-scripts allow-top-navigation-by-user-activation"></iframe>
    </div>
  </div>

  <script>
    async function getFrontendUrl() {
      const res = await fetch('/api/accounts/integrations/launch', { method: 'POST' });
      const { frontend_url } = await res.json();
      return frontend_url;
    }
    function openModal(url) {
      document.getElementById('lm-frame').src = url;
      document.getElementById('backdrop').style.display = 'flex';
    }
    function closeModal() {
      document.getElementById('lm-frame').src = 'about:blank';
      document.getElementById('backdrop').style.display = 'none';
    }
    document.getElementById('open').onclick = async () => openModal(await getFrontendUrl());
  </script>
</body>
</html>
Tip

Recommended size: { w: 900, h: 700 }