capacitor-compat

Installation
SKILL.md

Capacitor Compatibility

Ditto runs inside Capacitor's WKWebView on iOS and WebView on Android. Several common web APIs do not work in this environment. Always account for native platforms when writing code that interacts with browser-specific features.

What Doesn't Work in WKWebView (iOS)

  • <a download> file downloads — programmatically creating an anchor with a.download and clicking it silently fails. WKWebView ignores the download attribute entirely.
  • <a target="_blank"> new tabs — programmatic clicks on anchors with target="_blank" are blocked. There are no tabs in a native app.
  • window.open() — may be blocked or behave unexpectedly without user-gesture context.

For a deeper list of Apple Lockdown Mode restrictions that also affect WKWebView, load the lockdown-mode skill.

File Downloads and URL Opening

src/lib/downloadFile.ts provides two utilities that handle the web/native split automatically. Always use these instead of manually constructing anchors.

downloadTextFile(filename, content)

Saves a text file to the user's device. On web it uses the <a download> pattern. On native it writes to the Capacitor cache directory via @capacitor/filesystem and presents the native share sheet via @capacitor/share.

Installs
1
GitHub Stars
61
First Seen
Jun 22, 2026
capacitor-compat — soapbox-pub/ditto