Clicking markdown links opens URLs with null origin, breaking SPAs
Description
When clicking a markdown link in Claude Code's output, the URL opens in the browser with a null origin instead of a proper HTTP origin. This breaks single-page applications (SPAs) that rely on postMessage or other origin-dependent JavaScript APIs.
Steps to Reproduce
- Have Claude Code output a markdown link, e.g.,
[Open Thread in Hex](https://hc.hex.tech/pomelocare/thread/...) - Click the link in the terminal output
- The page opens but is blank/broken
Expected Behavior
The link should open with a proper origin (https://hc.hex.tech), and the page should render correctly.
Actual Behavior
The link opens with origin: 'null', causing JavaScript errors:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('<URL>') does not match the recipient window's origin ('null').
The page remains blank because the SPA's JavaScript fails to initialize properly.
Workaround
Copy and paste the URL into the browser address bar instead of clicking the link. This works correctly.
Environment
- Claude Code version: (current)
- OS: macOS (Darwin 25.2.0)
- Terminal: (default terminal used by Claude Code)
- Browser: (issue observed in browser opened from Claude Code)
Additional Context
This was discovered when using Hex (hex.tech) threads via an MCP integration. The same URL works perfectly when:
- Copy/pasted into the address bar
- Navigated to via in-app links within Hex
The issue is specifically with how Claude Code opens URLs when clicking markdown links.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗