This is controlled by Edge Chromium group policy not code. You can refer to the steps below to set the group policy to achieve the goal:
1. Send all sites not included in the Enterprise Mode Site List to Microsoft Edge
This setting lets you decide whether to open all sites not included in the Enterprise Mode Site List in Microsoft Edge. If you use this setting, you must also turn on the Administrative Templates\Windows Components\Internet Explorer\Use the Enterprise Mode IE website list policy setting and you must include at least one site in the Enterprise Mode Site List.
- Open Group Policy Editor.
- Click Computer Configuration > Administrative Tools > Windows Components > Internet Explorer.
- Double-click Send all sites not included in the Enterprise Mode Site List to Microsoft Edge.
- Select Enabled.
- Click OK or Apply to save these settings.
2. Configure which channel of Microsoft Edge to use for opening redirected sites
This policy enables you to configure up to three versions of Microsoft Edge to open a redirected site (in order of preference).
- In the same path of Group Policy Editor, double-click Configure which channel of Microsoft Edge to use for opening redirected sites.
- Select Enabled.
- Under Options, select your top three choices for the channel to use - Internet Explorer will redirect to the highest ranked choice that the user has installed on that device:
- Microsoft Edge Stable
- Microsoft Edge Beta version 77 or later
- Microsoft Edge Dev version 77 or later
- Microsoft Edge Canary version 77 or later
- Microsoft Edge version 45 or earlier
- Click OK or Apply to save these settings.
3. Use the Enterprise Mode IE website list
This policy setting lets you specify where to find the list of websites you want opened using Enterprise Mode IE.
- Create or reuse a Site List XML. Sample file is like below:
site.xml:
<site-list version="8">
<created-by>
<tool>EMIESiteListManager</tool>
<version>10.0.14357.1004</version>
<date-created>08/20/2020 07:45:39</date-created>
</created-by>
<site url="www.example.com">
<compat-mode>IE7</compat-mode>
<open-in>IE11</open-in>
</site>
</site-list>
- In the same path of Group Policy Editor, double-click Use the Enterprise Mode IE website list.
- Select Enabled.
- Under Options, type the location of website list. If it's in local, you can set it like this: file://D:/site.xml.
- Click OK or Apply to save these settings.