Render .html files in a sandboxed view. Toggle scripts ON for games, visualizations, and interactive documents.
Render .html files directly inside Obsidian. Sandboxed by default — toggle Scripts ON for games, D3/ECharts visualizations, and interactive documents.
Copy the html-viewer/ folder into <vault>/.obsidian/plugins/, then enable it in Settings → Community Plugins.
.obsidian/plugins/html-viewer/
├── manifest.json
├── main.js
├── styles.css
└── README.md
Restart Obsidian or reload plugins (Ctrl+P → "Reload plugins").
.html or .htm file in your vault| Button | Function |
|---|---|
| Source / Rendered | Toggle between raw HTML source and rendered view |
| Scripts: OFF / ON | Enable/disable JavaScript execution (default: OFF) |
| Refresh | Reload the file from disk |
Or via command palette: Open HTML viewer.
<script> tags removedonclick, onerror, etc.) strippedjavascript: pseudo-URLs neutralizedallow-same-originUse for: static pages, untrusted HTML, document previews.
javascript: links still strippedallow-scripts allow-same-originUse for: Canvas games, D3.js / ECharts / Three.js visualizations, interactive tutorials, and any trusted local HTML with scripts.
| Feature | Safe Mode | Interactive Mode |
|---|---|---|
| HTML + CSS | ✅ | ✅ |
| Images, video, audio | ✅ | ✅ |
| External CSS/images (CDN) | ✅ | ✅ |
Anchor links (#section) |
✅ | ✅ |
<canvas> 2D / WebGL |
— | ✅ |
| JavaScript applications | — | ✅ |
External <script src="..."> |
— | ✅ |
| Keyboard input (games) | — | ✅ |
localStorage |
— | ⚠️ session-only* |
| File auto-refresh (external edit) | ✅ | ✅ |
* localStorage works within a session but resets on refresh because each render uses a new Blob URL.
These are intentionally unavailable for security, even in Interactive Mode:
allow-forms)allow-popups)<input type="file">)allow-top-navigation)window.parent / Obsidian DOMjavascript: URLs — always neutralizedisDesktopOnly: false). Keyboard auto-focus is desktop-only; tap the game area for touch controls┌──────────────────────────────────────────┐
│ Obsidian Window │
│ ┌────────────────────────────────────┐ │
│ │ Toolbar: [Source] [Scripts] [↻] │ │
│ └────────────────────────────────────┘ │
│ ┌────────────────────────────────────┐ │
│ │ Sandboxed iframe │ │
│ │ ┌──────────────────────────────┐ │ │
│ │ │ Stripped: <script>, │ │ │
│ │ │ on*=, javascript: │ │ │
│ │ │ Blocked: forms, popups, │ │ │
│ │ │ file access, navigation │ │ │
│ │ └──────────────────────────────┘ │ │
│ └────────────────────────────────────┘ │
└──────────────────────────────────────────┘
Double-layer protection: regex sanitization at the content level + browser sandbox at the iframe level.
| Version | Changes |
|---|---|
| 1.2.0 | CSS namespace prefix (html-viewer-); race-condition guard; auto-refresh on external edit; delete handling; mobile-ready manifest |
| 1.1.2 | Strip javascript: pseudo-URLs |
| 1.1.1 | Auto-focus iframe for keyboard games |
| 1.1.0 | Scripts ON/OFF toggle |
| 1.0.2 | Dedup: same file → focus existing tab |
| 1.0.1 | Blob URL instead of srcdoc (fixes anchor navigation); flex layout |
| 1.0.0 | Initial release |
MIT