Modern WebView best practices
summary
AndroidX ships a WebView compatibility library (v1.0) that backports many Nougat+ behaviors to Lollipop+ devices, covering ~90% of devices and exposing ~40 newer WebView APIs like WebViewClientCompat so shouldOverrideUrlLoading honors the user gesture check everywhere. It recommends using loadDataWithBaseURL (or Base64 via Base64.encodeToString) instead of loadData to avoid opaque origins, to set a real HTTPS/HTTP base URL tied to the original domain, and to avoid custom URL schemes; Safe Browsing support is included.
AI-written summary · about
chapters (10)
- 0:00Introduction to WebViews
- 0:22Ecosystem and API history
- 2:14Introduction to AndroidX
- 2:53Secure navigation handling
- 4:47Implementing AndroidX
- 6:20Future of WebView APIs
- 7:00Loading in-app content
- 7:48Fixing old API issues
- 9:52Using base URLs securely
- 11:17Summary and conclusion
related talks
41mAndroid and the WebView
39mAndroid and the WebView
42mOvercoming Unsecurities in WebViews
25mWebView Implementations in the 2020s
40mSo, You Want To Use A WebView? [BAD AUDIO]
28mControlling Safe Browsing to Protect WebView
34mOvercoming JavaScript Unsecurities in WebViews
23mA pragmatic approach to WebViews
