markdown-webview icon indicating copy to clipboard operation
markdown-webview copied to clipboard

WKWebView: Fix Blank Screen and Prevent Memory Leaks

Open yccheok opened this issue 3 months ago • 0 comments

  1. Use removeScriptMessageHandlers to prevent memory leaks.

  2. Recreate the web view when it turns blank.

Reference: https://nevermeant.dev/handling-blank-wkwebviews/

We avoid using a timer-based solution since it's resource-intensive. Instead, we've observed that blank issues typically occur when the app is restored from the background. Therefore, a one-time check is performed during background restoration.

yccheok avatar Oct 30 '25 20:10 yccheok