You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[If you want to just run an Artifact](#if-you-want-to-just-run-an-artifact)
40
40
-[If you want to build an Artifact](#if-you-want-to-build-an-artifact)
41
41
-[If you want to view a previously built Artifact](#if-you-want-to-view-a-previously-built-artifact)
42
+
-[Caveats for opening a single-file build directly from the filesystem](#caveats-for-opening-a-single-file-build-directly-from-the-filesystem)
42
43
-[If you want to create a full project for one or more Artifacts](#if-you-want-to-create-a-full-project-for-one-or-more-artifacts)
43
44
-[Using Docker instead of npx](#using-docker-instead-of-npx)
44
45
-[Limitations](#limitations)
@@ -146,7 +147,7 @@ If you don't have an Artifact to run yet, and just want to try out the project,
146
147
147
148
The tool outputs an HTML file in your current directory, which contains all the code for running the application (HTML, CSS, JavaScript and a *favicon*).
148
149
149
-
This file can be deployed to any **static** web hosting service or cloud platform.
150
+
This file can be deployed to any **static** web hosting service or cloud platform, and **sometimes** it can even be opened directly from the filesystem (double-click the HTML file or open the URL `file://path/to/file.html`), but with some caveats (see below).
150
151
151
152
### If you want to view a previously built Artifact
152
153
@@ -162,6 +163,25 @@ There are two build types, with different preview methods:
162
163
-`npx run-claude-artifact view artifact-directory-name` (serve the directory)
163
164
- The tool launches a temporary web server and opens your browser. Press `Ctrl+C` to stop.
164
165
166
+
#### Caveats for opening a single-file build directly from the filesystem
167
+
168
+
There are always going to be some artifacts that won't be able to run correctly (or at all) when opened directly from the file system, but that is a fundamental browser restriction, not something the tool can solve.
169
+
170
+
A page opened as `file://` isn’t treated like a normal website. Browsers put it in a kind of sandbox, because a local file could otherwise snoop around your machine.
171
+
172
+
Succintly:
173
+
174
+
- Remote resource loading? **Often allowed.**
175
+
- Remote API calls? **Allowed only if CORS says yes.**
176
+
- Local-file cross-access? **Blocked.**
177
+
178
+
> Please make sure your artifact isn't being **blocked** by the browser's security policy, **before submitting a bug report**.
179
+
180
+
The best way to avoid issues and view a file locally is to place your `index.html` in a blank directory and run either:
181
+
182
+
*`npx run-claude-artifact view <your-directory>`, or
183
+
*`npx serve <your-directory>`
184
+
165
185
### If you want to create a full project for one or more Artifacts
166
186
167
187
Instead of just viewing or building an Artifact, you may create a full project for further development, and optionally push it to your own Git repository.
0 commit comments