Fix saved Claude.ai HTML pages so they actually work offline.
Saving a Claude conversation with Save As > Complete Webpage gives you a white page. The crossorigin attribute on the CSS <link> tag triggers CORS checks that fail on file://, the React app needs 17+ CDN modules that aren't saved locally, and Intercom/analytics scripts throw errors on every load.
The conversation content is already in the HTML. It just needs the CSS unblocked and the dead JavaScript removed.
fix_claude_export.py is a Python script that patches saved Claude.ai HTML files for offline viewing. It strips broken resources and optionally injects lightweight JavaScript to restore interactive features.
HTML cleanup (patches 1-3):
- Fixes the CORS-blocked stylesheet so the page renders
- Removes dead React bundle, CDN preloads, manifest, favicons, font preloads
- Removes Intercom chat widget (iframe, scripts, styles)
- Replaces missing preview image references with a transparent placeholder
Interactive features (patches 4-8):
- Show more / Show less toggle for truncated messages
- Thinking panel expand/collapse with a console warning about empty panels
- Working copy buttons for messages and code blocks (green checkmark animation)
- Scroll to bottom button
- Disables offline-only buttons (Retry, Edit, Version nav) with a red hover indicator
python fix_claude_export.py --all page.html # patch everything
python fix_claude_export.py page.html # interactive patch selection
python fix_claude_export.py --all -r ~/claude-exports # recursive
python fix_claude_export.py --all --backup page.html # backup firstRun without --all to get a checkbox menu:
Select patches to apply:
[x] 1. Core: Fix CORS CSS, remove dead scripts & resources
[x] 2. Remove Intercom chat widget
[x] 3. Fix broken preview images
[x] 4. Show more / Show less toggle for messages
[x] 5. Thinking panel expand/collapse (+ empty panel warning)
[x] 6. Copy buttons (action bar + code blocks)
[x] 7. Scroll to bottom button
[x] 8. Disable offline buttons (Retry, Edit, Version nav)
Toggle: type numbers (e.g. '3 5'), 'a'=all, 'n'=none
Apply selected [Enter] >
Type numbers to toggle patches off, press Enter to apply.
usage: fix_claude_export.py [-h] [-r] [-b] [-a] [-s SELECT] [paths ...]
positional arguments:
paths HTML files or directories (default: current dir)
options:
-r, --recursive recurse into subdirectories
-b, --backup create .bak before patching
-a, --all apply all patches, skip the menu
-s, --select SELECT comma-separated patch numbers (e.g. '1,2,3,6')
Thinking panel content lives in React state, not in the DOM. If a panel was collapsed when you saved the page, its content is missing and can't be recovered.
The patcher detects empty panels, disables their toggles, and logs a warning:
[Claude Export Patcher] 12 thinking panel(s) saved without content.
Thinking content lives in React state and is NOT captured by "Save As".
To fix: expand all thinking panels BEFORE saving the page.
A helper script you run in the browser console before saving the page. It clicks every collapsed thinking panel and hits "Show more" inside each one to make sure the full content is in the DOM.
- Open your conversation on claude.ai
- Open the browser console (F12 > Console)
- Paste the contents of
expand-thinking-panels.jsand press Enter - Wait for it to finish (progress is logged to console)
- Save the page (Ctrl+S > "Webpage, Complete")
- Run
fix_claude_export.pyon the saved file
The patcher identifies Claude pages by checking for data-theme="claude" in the first 4KB. Files inside _files companion directories are skipped automatically. Already-patched files are detected by a version marker in the injected script. Running a newer version of the patcher will upgrade older patches in place.
Python 3.8+ with no external dependencies.