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.