Skip to content
All articles

Why Your Page Works Locally but Breaks Once Hosted

8 min readHosting, Security

A page that works locally but breaks once hosted is usually loading something from another website: a chart library, a CSS framework, a font, an icon set. On your own computer the browser fetches those without asking. On SnapHost a published page loads scripts, styles and fonts only from the files you published with it, so the parts that came from elsewhere are blocked and the page renders with holes in it. The fix is one of two things: put those files in the upload, or tell SnapHost which outside addresses the page is allowed to use.

This post explains why the page looks fine on your machine and empty on the link, how to see which part is missing before you send it to anyone, what each fix costs, and the way of building a page that avoids the problem altogether.

Why a page works locally but breaks once hosted

Ask ChatGPT or Claude for a dashboard and you get one HTML file. Open it from your desktop and it is perfect: a title, three charts, a table that sorts when you click the headers. Then you publish it, open the link on your phone, and the charts are empty squares. The title is there, the table is there, the numbers are not.

Look inside the file and the reason is a handful of lines near the top. The AI did not write the charting code itself; it pulled in a library from a content delivery network, a CDN, with a line like <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>. The same goes for the styling, which often comes from a Tailwind or Bootstrap CDN, and for the font, which usually comes from Google Fonts. On your computer the browser fetches each of those from the internet and the page assembles itself. The file did not contain the charts. It contained instructions for where to go and get them.

What SnapHost blocks by default, and what it lets through

Each published site is served with a content security policy, which is a set of rules the browser enforces about where the page may load things from. By default the rules say: scripts, stylesheets, fonts, embedded frames and runtime connections come from the site's own files only. A script from a CDN, a stylesheet from a framework's CDN, a font file from a font host: none of them is fetched. The browser skips them and renders what is left, which is why you see the heading and the layout but not the chart.

Two things are allowed from the start. Images may come from any https address, so a logo hotlinked from your company site or a photo from an image host shows up fine. And the page may talk to SnapHost's own data service, which is what lets a form your AI built save its submissions without any setup. The data backend covers that.

The policy exists because a published page runs in a sandbox on its own isolated origin, separate from your account and from other sites, and a page that could load code from anywhere would be a way around that. Allowing a specific outside address, which is the second fix below, widens only what the page may fetch. It does not loosen the sandbox itself.

The publish report tells you before a reader does

You should not have to open the link on your phone to find out. When you publish or update a site, SnapHost scans the page for references to other websites and lists each address it will block, together with how the page uses it: scripts, stylesheets, fonts, embeds or connections. In the dashboard that list appears in the publish report with an Allow button beside each row. If your AI published the page for you, the same list comes back to it as text, with the question it should put to you: this address was detected, do you want to trust it?

Nothing is trusted on its own. The scan only reports; deciding what the page may reach is yours.

Be clear about what the scan can see. It reads the tags in the page and the imports in its scripts, so a CDN script line or a Google Fonts link is caught. A call to an outside API written inside a script, something like a fetch to a weather service when a button is pressed, is beyond a static read, so the publish report can come back clean and the button can still fail. The policy blocks that call either way; the scan just did not get to warn you. If a page talks to an API, assume the address needs allowing and add it before you test.

Fix one: put the files in the upload

The fix that works whatever plan you are on is to stop loading the library from elsewhere and ship it with the page. Tell your AI: "download the libraries this page loads from CDNs, save them next to the page, and change the page to load the local copies." You get a folder with the HTML file and a few script and font files beside it. Zip the folder, drag the zip into SnapHost, and the page now loads everything from itself. Nothing is blocked because nothing leaves.

If you are on Free this is the fix, since allowing outside addresses is not part of that plan. The publish report says so when it finds a blocked address on a Free workspace, and tells you to include the files instead.

The one thing to get right is that the files have to actually be in the zip. The classic mistake is uploading the HTML file on its own after the AI saved its scripts into a folder next to it. The page then points at scripts/chart.js, nothing in the upload has that name, and the chart is blank for a different reason. SnapHost scans for this too and names the missing files in the same report. What to send a client instead of a zip file has more on packaging a page and its files so the right thing gets uploaded.

Fix two: allow the address

On Pro you can tell a site which outside addresses it may load from. Open the site in the dashboard, go to the General tab, and under External connections type the address, for example https://cdn.jsdelivr.net, and click Allow. Or click Allow next to the row in the publish report, which fills it in for you. If your AI is connected, say "allow that address on this site" and it does the same. A site can hold up to ten allowed addresses.

Allow the origin, not the full path: https://fonts.googleapis.com, not the long link to one particular font. Google Fonts needs two, one for the stylesheet and one for the font files, which is why a font often shows up as two rows in the report. If the site uses a brand kit, the kit's Google fonts are allowed on the site for you when you publish.

This is the right fix when the library is large, when the page genuinely has to call a live API, or when you expect your AI to keep updating the page and do not want to re-vendor files each round. It is the wrong fix for an address you do not recognise. Your AI will sometimes pull in a script from a host you have not heard of; before you allow it, ask what it is for. A library you can name from a CDN you can name is fine. A mystery address is a reason to ask for the page to be rebuilt without it.

The way that avoids the problem

If you are starting fresh, there is a route where none of this comes up. Ask your AI for the page as a single React component, the .tsx file Claude hands you as an artifact or ChatGPT as a canvas, and publish that file as it is. SnapHost compiles it when you publish, bundles in the libraries it imports and generates the Tailwind styles its classes name, so the finished page carries everything it needs and loads nothing from anywhere else. Charts via recharts, icons via lucide-react, animation via framer-motion and the common Radix primitives are included; an import of anything outside that list is refused by name at publish, which is a clearer failure than a blank box. How to publish a React component as a web page walks through it.

Plain Markdown is the other safe route. A report, a memo, meeting notes: a .md file becomes a styled page with no scripts in it, so there is nothing to block.

Checking the page before you send the link

  1. Publish it, and read the publish report before you copy the link. A row under blocked connections is the problem this post is about; a row under missing files is a file that did not make it into the upload.
  2. Decide per row. A library you recognise: allow it on Pro, or have your AI vendor it on any plan. An address you do not recognise: ask your AI what it is before doing anything.
  3. If the page calls an API from a script, allow that API's address even when the report is clean, because the scan does not see inside script bodies.
  4. Open the link yourself, on your phone if you can. Each box that should hold something should hold it.
  5. Once it is right, it stays right. Updating the page keeps the allowed addresses, and a vendored library travels with each new upload as long as the files stay beside the page.

What each plan gives you here

On Free you can have up to three pages at a time, each private to up to three people or public, served at sites.snaphost.ai with a small SnapHost mark, and a new page starts out public. Vendoring the files is the fix on Free; allowing outside addresses is not available there. Pro is 19 euros a month per member who can publish, readers cost nothing, a new page starts out private, and it is where External connections live, along with passwords, end dates, custom domains and version history. Pricing has the current plans, and what you can publish covers formats, limits and the one paragraph on loading things from other sites that this post expands on.

The blank chart is not a bug in your page and not a bug in the host. The page was built to fetch pieces from the open internet, and the host does not let pages do that unasked. Ship the pieces with the page, or name the addresses it may use, and it looks the way it did on your desk.

Keep reading