Overview
Lab 11 generates an HTML report and displays it using FMX's TWebBrowser component. On iOS, Apple removed UIWebView in iOS 14 (deprecated since iOS 8) and requires WKWebView. On Android, WebView security requirements have tightened significantly. Delphi 13's TWebBrowser uses WKWebView on iOS, but the HTML content loaded, the LoadFromStrings API, and security settings need verification against modern webview restrictions.
Background
iOS Changes
- iOS 14+:
UIWebView is completely removed from the OS. Any app still linking against UIWebView is rejected by the App Store. Delphi 10.3's TWebBrowser used UIWebView internally.
- Delphi 10.4+:
TWebBrowser was updated to use WKWebView. However, WKWebView has stricter security:
- Local file loading requires
WKWebView.loadFileURL:allowingReadAccessToURL: rather than loadHTMLString:baseURL:.
- Inline
<script> tags may be blocked by the Content Security Policy.
- Mixed content (HTTP within HTTPS context) is blocked.
Android Changes
- Android's WebView is a standalone, auto-updating system component (since Android 5). Security patches are pushed independently of the OS.
WebSettings.setAllowFileAccess(false) is the default since Android 11 — local file:// URIs in HTML are blocked.
- JavaScript is disabled by default in Android WebView; it must be explicitly enabled.
Current Code
Lab 11 builds an HTML string from log entry data and calls wbReport.LoadFromStrings(HTMLContent, ''). This may fail silently in WKWebView if the HTML references local resources or if the base URL is empty.
Files Affected
lab-src/Lab11.../frames/uReportFrame.pas (HTML generation and WebBrowser loading)
lab-src/Lab11.../forms/formMain.pas
Steps to Address
- Verify that Delphi 13's
TWebBrowser.LoadFromStrings correctly maps to WKWebView.loadHTMLString:baseURL: on iOS — test with a simple HTML string.
- Update the HTML report template to be self-contained (no external CSS or JS file references) since local file access is restricted in
WKWebView.
- If the report HTML uses inline styles only (no
<link> or <script src="">), verify it renders correctly — this is the safest approach.
- On Android, confirm that the HTML-only report renders correctly without requiring
setAllowFileAccess(true).
- If the report uses JavaScript (e.g., for sorting or charts), explicitly note that
JavaScriptEnabled must be set and explain the security implications in the lab instructions.
- Test the HTML report with special characters (accented characters, quotes in note fields) to ensure proper encoding — use
TNetEncoding.HTML.Encode for user-entered content in the report.
- Verify
TWebBrowser navigation events (OnShouldStartLoadWithRequest) still fire correctly in Delphi 13 if used for link interception.
Test Plan
Overview
Lab 11 generates an HTML report and displays it using FMX's
TWebBrowsercomponent. On iOS, Apple removedUIWebViewin iOS 14 (deprecated since iOS 8) and requiresWKWebView. On Android,WebViewsecurity requirements have tightened significantly. Delphi 13'sTWebBrowserusesWKWebViewon iOS, but the HTML content loaded, theLoadFromStringsAPI, and security settings need verification against modern webview restrictions.Background
iOS Changes
UIWebViewis completely removed from the OS. Any app still linking againstUIWebViewis rejected by the App Store. Delphi 10.3'sTWebBrowserusedUIWebViewinternally.TWebBrowserwas updated to useWKWebView. However,WKWebViewhas stricter security:WKWebView.loadFileURL:allowingReadAccessToURL:rather thanloadHTMLString:baseURL:.<script>tags may be blocked by the Content Security Policy.Android Changes
WebSettings.setAllowFileAccess(false)is the default since Android 11 — localfile://URIs in HTML are blocked.Current Code
Lab 11 builds an HTML string from log entry data and calls
wbReport.LoadFromStrings(HTMLContent, ''). This may fail silently inWKWebViewif the HTML references local resources or if the base URL is empty.Files Affected
Steps to Address
TWebBrowser.LoadFromStringscorrectly maps toWKWebView.loadHTMLString:baseURL:on iOS — test with a simple HTML string.WKWebView.<link>or<script src="">), verify it renders correctly — this is the safest approach.setAllowFileAccess(true).JavaScriptEnabledmust be set and explain the security implications in the lab instructions.TNetEncoding.HTML.Encodefor user-entered content in the report.TWebBrowsernavigation events (OnShouldStartLoadWithRequest) still fire correctly in Delphi 13 if used for link interception.Test Plan
<,&, accented letters in notes) renders correctly without garbled text.UIWebViewsymbol is linked in the iOS binary (verify withnmor check Delphi 13 release notes).TWebBrowserdoes not show a blank white screen on first load (timing issue that affected some Delphi versions).