SampleTestFiles
Search

HTML Viewer

Preview HTML as a rendered page.

Preview

Local Your input is rendered. Found a problem? Report an issue

What the HTML Viewer does

The HTML Viewer renders your HTML in a sandboxed frame as you type, so you can preview a snippet or email template without creating a file.

Using the HTML Viewer

  • The preview is redrawn as you type.

Details and limits

  • The frame has an empty sandbox attribute: scripts, form submission, pop-ups and navigation of the surrounding page are all blocked.
  • A relative URL in your HTML, such as src="logo.png", is resolved against this site and will not be found. Use absolute https:// URLs for images you want to see.
  • There is no output to copy or download: the preview is the result.

Worked example: Previewing a self-contained HTML + inline CSS email card

Paste this self-contained HTML and <style> snippet into the editor to preview how it renders inside the isolated iframe viewport:

<style>.alert-box { font-family: system-ui, sans-serif; max-width: 420px; padding: 16px 20px; border-left: 4px solid #0d9488; background: #f0fdfa; color: #134e4a; border-radius: 6px; }.alert-box strong { display: block; margin-bottom: 4px; }
</style>
<div class="alert-box"> <strong>Deployment succeeded</strong> Build #418 is live on edge nodes (42 ms TTFB).
</div>

The live preview pane immediately renders the styled teal alert box so you can adjust padding, border radius, and typography before copying the markup into your project or email campaign.

Limits and what this tool cannot do

  • JavaScript and event handlers are blocked for security: The preview runs inside a restricted <iframe sandbox=""> with <script> tags and inline onclick / onload attributes disabled so untrusted HTML snippets cannot execute malicious code.
  • Relative image and stylesheet paths (/css/app.css, ./hero.jpg) cannot resolve: Because the preview renders in an in-memory srcdoc frame rather than on your web server, relative file paths have no server folder to load from. Use inline <style> blocks, inline SVGs, or full https:// / data:image/... URLs.

Questions

Why does my JavaScript not run in the preview?

The preview frame is sandboxed without permission to run scripts, so pasted code cannot act on this site. To test scripts, open the file directly.

Why isn't my <script> tag running inside the HTML Viewer?

To make it safe to paste and inspect unknown or third-party HTML snippets without risking cross-site scripting (XSS), the preview iframe runs in a strict no-script sandbox that renders only HTML and CSS.

Can I test CSS media queries and dark mode inside the preview?

Yes. Any <style> block containing @media rules or CSS custom properties (var(--color)) is evaluated by your browser's rendering engine inside the preview pane.