From source to browser frame

HTML Preview Not Working?

Fix a blank or stale HTML preview with checks for the selected file, CSS paths, JavaScript errors and refresh behavior in HCODX.

Real browser renderingSeparate preview frameDebugging checklist
Clear answer

Find why the HTML preview is blank or out of date

The preview runs a document in a separate browser frame so you can inspect the output of your project without leaving the editor.

That distinction explains both the fidelity and the limits. The frame uses a real browser engine, so ordinary layout, fonts, media queries and DOM interactions behave like browser content. But a frame is not your future production server: relative paths, external resources, permissions and server-side endpoints can behave differently after deployment.

Start by identifying the failure: no document, missing styles, an image that cannot load, an interaction that fails, or an older version of the page. Check the selected entry file, then resource paths and console messages, then refresh behavior. The separate preview shell renders front-end files in a browser; a server-side endpoint still needs a real server.

Markup is parsed, not compiled

HTML defines elements and their structure. The browser builds a document tree even when some markup is malformed.

CSS is applied by the browser

A rule can be valid but invisible when its selector misses, specificity loses, or the stylesheet fails to load.

JavaScript has a separate failure path

A script exception can stop an interaction while the HTML and CSS still render correctly. The console is the place to look.

Under the hood

Four checkpoints between a keystroke and the rendered page

Pinpoint the stage that failed before rewriting code that already works.

Confirm the file you changed Make sure the active project and file are the ones the preview loads. A correct edit in an unused file has no visible effect.
Confirm the document structure Inspect the element in the frame. If it is absent, check nesting, closing tags and whether the code is in the expected HTML file.
Confirm styles and assets If the element exists but looks wrong, check the CSS selector and resource URLs. An external font or image may fail independently of the HTML.
Confirm script execution If the page looks right but a control does nothing, inspect console errors and check that the queried element exists before the handler runs.

A common script-timing mistake

<script>
  // Runs before #send exists: querySelector returns null.
  document.querySelector("#send").addEventListener("click", () => console.log("Sent"));
</script>
<button id="send" type="button">Send</button>

<!-- Move the script below the button, or wait for DOMContentLoaded. -->

A preview that shows the button but ignores clicks is not necessarily stale. In this example the script throws before the button is created, so the first useful clue is a console error—not another CSS edit.

Troubleshooting

A blank, stale or mismatched preview: what to inspect

Use the symptom to choose the next check rather than pressing refresh repeatedly.

01

Blank frame

Check for a document-load error, an accidental full-page overlay, or white text on a white background. Inspect the frame before assuming the editor lost your work.

02

Old output

Verify the current project and file, then refresh the preview manually. If auto-updates are disabled, source changes will wait until you request a rerun.

03

Missing image or font

Review the URL and resource origin. A path that works on a deployed domain may not resolve the same way in a preview frame.

04

Works here, fails after publishing

Compare deployment paths, server headers, API URLs and CORS rules. The preview validates the front-end behavior it can see, not the entire hosting environment.

A false blank page

When the content is present but a layer covers it

A white preview is not proof that HTML failed to load. A positioned element can cover otherwise valid content.

In this example the heading exists and is styled, but a fixed white cover sits above it. The frame looks blank. Inspect the preview document: if the heading is present in the DOM, the next question is which element paints over it, not whether the editor saved the source. Temporarily disable the .cover rule or remove the covering element to confirm the diagnosis.

This is different from a missing resource or a script error. The browser successfully parsed the HTML and applied CSS; the CSS simply produced an unintended visual result. A systematic preview check keeps you from rewriting the heading or repeatedly refreshing the frame.

The source contains visible content; a later fixed layer hides it in the rendered frame.
<main><h1>Release notes</h1><p>The document loaded.</p></main>
<div class="cover" aria-hidden="true"></div>
<style>
  main { color:#111; padding:2rem; }
  .cover { position:fixed; inset:0; background:#fff; z-index:10; }
</style>
<!-- Remove .cover or correct its stacking behavior to reveal the page. -->
Two environments

The editor preview and a published URL answer different questions

A local edit-and-preview loop is fast feedback; a staged or published page is the release check.

Compare

Preview frame

Best for immediate visual and client-side behavior checks while source is changing. It is a development context, so verify resources and permissions again on the final host.

Compare

Exported files

Best for checking the actual package you will move. Extract the ZIP and verify filenames, folder relationships and linked assets.

Compare

Staging or published site

Best for testing real routes, headers, API permissions, caching, fonts and device/browser combinations under the intended host.

When one dependency fails

Diagnose a missing script, font or image by its request

A resource failure is not always a markup failure. Read the failed request before changing the page structure.

Copy the resolved URL In the preview’s network panel, inspect the exact URL requested for the missing asset. Compare it with the file’s actual location or the CDN address you intended.
Read the response or browser block A 404 points toward a missing path. A CSP block, module CORS error or mixed-content warning is a different class of failure and will not be repaired by renaming a CSS selector.
Check the preview context An API may allow one origin but deny another. Inspect the request’s Origin header and resolved URL instead of assuming the preview uses the same origin and base path as the deployed site.
Retest on the intended host After correcting the URL or server policy, verify the asset in preview and on staging. If only one environment fails, document that origin-specific difference instead of hiding it.

Classic cross-origin script tags, JavaScript modules and fetch requests have different loading rules. Name the request type before concluding that every failure is “CORS”.

Questions

Live preview questions worth asking

No. It is an iframe that loads a browser document. Buttons, scripts and responsive CSS can run there, subject to browser rules and the current preview configuration.

HTML parsing and external loading are separate operations. Check the request URL and status, Content Security Policy, and console error. JavaScript modules and fetch calls may also face CORS checks; do not assume every classic script failure is CORS.

It gives a useful browser render, but deployment paths, headers, APIs, fonts and the visitor’s device can differ. Treat it as a development check, then test a deployed URL on target devices.

Yes when structure is uncertain. Browsers recover from many markup errors, so a page looking acceptable does not prove its nesting, IDs or accessibility associations are correct.

Confirm the edited stylesheet is linked and its selector matches the rendered element. Then inspect whether another rule overrides the declaration or a fixed-size child prevents the layout change.

A blank render can come from a load failure, hidden content, an overlay or white-on-white styling. Check the active project, frame and console before assuming the source disappeared.

No. The preview runs browser-native front-end output. PHP, private database access and other server runtimes require a separate backend environment.

Refreshing the rendered frame and preserving a durable project copy are separate actions. Keep a ZIP export of important work outside the browser profile.

Debug the rendered page with the source beside it

Open HCODX, make a small change, and follow the preview checkpoints if the result surprises you.

Instant HTML Runner & Viewer with Live Preview

Need to run a short HTML, CSS and JavaScript snippet? The HTML Runner Online has a focused editing surface with live output.

Open HTML Runner Online