[FEATURE] Forward URL fragments into published artifacts so section deep links work
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Published artifacts (claude.ai/code/artifact/{id}) render the page inside a sandboxed cross-origin iframe (*.claudeusercontent.com). The URL fragment on the outer artifact URL is never forwarded into that frame, so section deep links do not work: opening https://claude.ai/code/artifact/{id}#some-section always lands at the top of the page.
This matters for exactly the kind of long, multi-section report artifacts the docs encourage. The Page constraints table says "For multi-section content, Claude uses in-page anchors rather than separate files" - so pages are already built with id-anchored sections and tables of contents - but there is no way to share a link that lands a teammate on a specific section. "See finding 3" has to travel as prose next to the link instead of in the link.
Verified from inside a published page: location.hash in the frame stays empty when the outer URL carries a fragment (polled for several seconds after load, so it is not a load-timing issue). Writing the hash from inside the frame via history.replaceState also cannot help, since the frame cannot touch the top-level URL across origins.
Proposed Solution
Forward the outer URL fragment into the artifact frame so standard anchor behavior works:
- On initial load, propagate the fragment from
claude.ai/code/artifact/{id}#xinto the frame (append it to the frame src or postMessage it alongside the existing__frame_inithandshake), so the browser's native scroll-to-anchor fires. - Forward subsequent top-level
hashchangeevents the same way. - Ideally the reverse direction too: let the frame propose a hash update (postMessage) that the shell reflects onto the top-level URL, so copying the address bar mid-read captures the current section. This half is optional; the load-time forwarding is the valuable part.
The viewer shell already exchanges postMessages with the frame for theme, sizing, and scroll restoration - and the frame runtime's scroll-restore logic already checks location.hash and defers to it, so the in-frame half of this behavior appears to exist already. It just never receives a hash.
Alternative Solutions
- Sticky in-page table of contents with scroll-spy: works for a reader already on the page, but cannot make a shared link land on a section.
- Putting the section name in the fragment anyway (
#coverage-fleet) as a human-readable hint the recipient manually finds via the TOC: current workaround, but it silently fails as a real anchor. - Attaching the raw HTML file so recipients open it locally where
file:///...#sectionworks: loses the artifact's access control, live updates, and single canonical URL. - A "copy link to section" button inside the page: cannot work, because the page cannot construct a functional deep link at all today (and clipboard access is also restricted in the sandbox).
Priority
Medium - Would be very helpful
Feature Category
Other
Use Case Example
- Claude Code publishes a long multi-section engineering report as an artifact (results matrix, per-site sections, findings) with an
id-anchored TOC. - I share the artifact with my team and want to point a colleague at one finding:
.../artifact/{id}#findings. - Today the link opens at the top of the page and the fragment is silently dropped; the colleague scrolls or uses the TOC to find the section.
- With fragment forwarding, the link lands them on the section directly - same behavior as any static HTML page.
Additional Context
- Observed on Claude Code v2.1.x published artifacts, viewer at
claude.ai/code/artifact/{id}, July 2026. - The docs recommend in-page anchors for multi-section artifacts, which makes the missing fragment forwarding feel like the last unfinished piece of that story.
- Notion, Google Docs, and Confluence all support block/heading-level deep links; for artifacts, plain URL-fragment forwarding would be enough.
4 Comments
+1 — independently hit this wall this week and can add two empirical data points, plus a use case beyond section anchors.
Query params are not forwarded either. Since the fragment is dropped, we tested whether a query param on the outer URL (
claude.ai/code/artifact/<id>?view=...) reaches the frame, hoping to use it as an alternative deep-link channel: it doesn't (frame boots with only its own__frame_tinlocation.search). So as of Aug 2026 there is no URL-shaped channel into a published artifact at all — fragment and query are both stripped at the wrapper, on both the/code/artifact/and/code/frame/routes.The use case generalizes past section links: view state. Our report artifacts embed a corpus explorer (~26k samples) whose full filter state lives in the fragment (
#explorer?dataset=x&category=y), written viahistory.replaceStateas the reader filters — on any plain static page, every configuration a reader reaches is a shareable link. Inside the artifact frame that whole mechanism runs fine but is invisible to the address bar, exactly as this issue describes.What we shipped as a workaround is a measure of the gap: a "copy link to this view" button that reconstructs
https://claude.ai/code/artifact/<id>from the frame's own hostname (<id>.frame.claudeusercontent.com) and appends the fragment — plus an in-page "open a shared view" paste box, because the recipient's frame never sees the fragment of the link they clicked: they have to paste the same link back into the page to apply it. One shareable link, but with a manual paste step that point 1 of the proposal would delete outright.Also +1 on point 3 (reverse forwarding): the in-frame
replaceStatehalf already works today; reflecting it onto the top-level URL would make copy-the-address-bar capture the reader's current view.---
Investigated and written by Claude (Fable 5) in a Claude Code session, posted from Clément's account. Co-Authored-By: Claude <noreply@anthropic.com>
Closing for now — inactive for too long. Please open a new issue if this is still relevant.
I'm also interested in this
I've built various short lived (offsite scheduling, RFP reviews), and longer lived artifacts, each of which has some type of individual facet that would benefit from an ability to be linked directly. That there is no way to deep link to any part of the artifact, pushes quick development decisions away from artifacts and towards other traditional architectures and SaaS solutions.