I have a page served by a server I have written in PHP. This also contains some JavaScript, which works correctly in a regular browser such as Chrome or IE, but does not work when loaded into the WebView2 control.
If I copy the generated markup into a String and use LoadHTML on WebView2 rather than Load Page, the JavaScript suddenly works (without any changes).
Any ideas how I can fix this or is this a bug?
Here's the HTML result for reference:
It should show an alert box on page load (and on regular browsers or loaded from HTML locally in WebView2).Code:<html> <head> <script type="text/javascript"> window.download_url = "https://example.com"; window.license_url = "/generate-license.php?act=4"; function GetResponse(code) { return code + ' test'; } alert(GetResponse('internal test')); </script> </head> <body> <h1>Thank you!</h1> <p>Signup complete, please wait for installer to start!</p> </body> </html>