I have an ASP.NET WebForm website application running under a WebView (WKWebView) developed with DotNet MAUI, and I've been experiencing problems since compiling with iOS 26. Specifically, there are two buttons on the webform. These buttons use some JavaScript code defined within the page via onClientClick from the ASPX page, while the button is also called from the server side using code like this:
string encodedMessage = System.Web.HttpUtility.JavaScriptStringEncode(diffLocationMessage, true);
string scriptError = $"hideLoading(); showBootStrapStyleAlert({encodedMessage}, 'error');";
ScriptManager.RegisterStartupScript(this, GetType(), "Alert_Error_DiffLoc", scriptError, true);
Some of these JavaScript scripts work, while others don't.
At the same time, the OnClientClick button on the MAUI side uses a special handler to process a parameter (ENTRY or EXIT) received from these buttons and updates some hidden fields and labels on the webform side.
await myWebView.EvaluateJavaScriptAsync( $"if(document.getElementById('hfLatMaui')) document.getElementById('hfLatMaui').value = '{latitude}';"); await myWebView.EvaluateJavaScriptAsync( $"if(document.getElementById('hfLonMaui')) document.getElementById('hfLonMaui').value = '{longitude}';"); await myWebView.EvaluateJavaScriptAsync( $"if(document.getElementById('hiddenCurrentLat')) document.getElementById('hiddenCurrentLat').value = '{latitude}';"); await myWebView.EvaluateJavaScriptAsync( $"if(document.getElementById('hiddenCurrentLon')) document.getElementById('hiddenCurrentLon').value = '{longitude}';");
// Part 2: Update labels await myWebView.EvaluateJavaScriptAsync( $"if(document.getElementById('lblLatMaui')) document.getElementById('lblLatMaui').innerText = '{latitude}';"); await myWebView.EvaluateJavaScriptAsync( $"if(document.getElementById('lblLonMaui')) document.getElementById('lblLonMaui').innerText = '{longitude}';");
Server-side operations are performed with the values received from here.
While the above problems did not occur up to iOS 18.x and Xcode 16.4, they are now occurring.
What should I do? What do you suggest?
NOTE-1: When my iPhone is connected to my M4 Pro PC via a Type-C Lightning cable, I saw that everything worked correctly when I ran the page under the Develop menu in Safari - I tested it.
NOTE-2: The problem is, as explained in NOTE-1, that the WebView executes some JavaScript behaviors while blocking others.
Thanks for the careful diagnostic work. Two observations from your post jump out:
- Same source code, two builds: the Xcode 16.4 / iOS 18 SDK build runs correctly in iOS 26, the Xcode 26 / iOS 26 SDK build does not.
- The page itself runs correctly in Safari with Web Inspector attached.
Together, those localize the problem to how the WKWebView is being set up or driven inside your app at the iOS 26 SDK build, rather than the page or the device. The "some JavaScript executes while others don't" pattern is the most useful clue for narrowing further.
That pattern is consistent with WKContentWorld isolation in WKWebView. WKContentWorld separates JavaScript execution into distinct namespaces:
- The page world (
WKContentWorld.pageWorld) — JavaScript executed here can see page-defined globals, including functions defined in the page's<script>tags such ashideLoading()andshowBootStrapStyleAlert(). - A client world (
WKContentWorld.defaultClientWorldor a named world) — JavaScript executed here can manipulate the DOM, but runs in an isolated JavaScript context that does not see page-defined globals or functions.
The simple two-argument evaluateJavaScript:completionHandler: is documented to evaluate in pageWorld. The fuller evaluateJavaScript:inFrame:inContentWorld: and callAsyncJavaScript: forms require the caller to specify the world explicitly.
If, somewhere in the path between your code and WKWebView, the calls go through the inContentWorld variant with a non-pageWorld value, the symptom fits exactly: DOM updates like document.getElementById('x').value = ... still work (the DOM is shared across worlds), but calls to page-defined functions silently fail (page globals are not visible from a client world).
To narrow this down, I'd suggest attaching Safari Web Inspector to the WKWebView inside your running app (not the same page loaded directly in Safari). With the device connected, in Safari on the Mac choose Develop → [Your iPhone] → [the WKWebView in your app]. With the Web Inspector attached while the failing operation runs, the JavaScript console will show what's actually happening:
- A "function is not defined" error → JavaScript is running but in a world that can't see the page-defined function. That points at WKContentWorld isolation.
- A CSP or cross-origin error → a content security policy is blocking the script.
- An exception reading or writing a DOM node → the DOM-side call also failed and timing is the issue (the script ran before the element existed).
- Nothing in the console at all → the script never reached WKWebView, which is a different class of issue (the call may be failing or being skipped earlier in the path).
Sharing what the console shows during the failing operation would let me narrow this further.
One additional debugging note: the Network panel in Web Inspector will show whether any required script files or page resources fail to load on the new build but loaded on the old one. A late-loading <script> can produce intermittent "function not defined" symptoms that look like the page is partly working.