Reputation: 21
We has a solution built on a WebBrowser that will use the JS engine. After upgrading to Windows 11 22H2, we found that the solution behaves differently from before. We did some research, and then found that Windows 11 22H2 has a different way of using the JS engine from the previous versions:
Before Windows 11 22H2, when the WebBrowser calls the JS engine, it loads jscript9.dll and jscript.dll for the job;
In Windows 11 22H2, when when the WebBrowser calls the JS engine, it loads jscript9.dll and jscriptlegacy.dll.
Due to this difference, our solution has practically stopped working. (We tried a few solutions, but the result is not good).
We believe there is little chance for you to change the current behavior of Windows 11 22H2.
It is based on COM, and uses Webbrowser control to load JavaScript. There are many JavaScript objects in the application. Each JavaScript object is associated with a C++ object. The C++ object stores the IDispath pointer of the JavaScript object, so that it is possible for the C++ object to directly call the JavaScript object. Before 22H2, the JavaScript object that IDispatch points to stays valid during the lifetime of the JavaScript object. However in 22H2, the JavaScript object becomes a temp object, and gets destroyed by the JavaScript engine after it is passed as parameter to the C++ object. And then if the C++ object wants to call the JavaScript object, the call would fail because it cannot find the JavaScript object. Then we tracked the calls, and found that there is a difference in the files being loaded when the WebBrowser calls the JavaScript engine.
Can you advise us how it is possible for us to change our solution to still use the old way in Windows 11 22H2 (when the WebBrowser calls the JS engine, it loads jscript9.dll and jscript.dll)?
Upvotes: 2
Views: 1241
Reputation: 53
You can use the policy to control the behavior related to JScript vs JScript9legacy. Of course, since it's a policy which goes into a registry key, you could directly change the registry key too.
Administrative Templates -> Windows Components -> Internet Explorer -> Replace JScript by loading JScript9Legacy in place of JScript via MSHTML/WebOC
https://admx.help/?Category=Windows_11_2022&Policy=Microsoft.Policies.InternetExplorer::JScriptReplacement
Upvotes: 3