2

Windows 10 ships with both modern Microsoft Edge browser, and the legacy Internet Explorer 11.

Based on analytics, I suspect some of my Windows 10 users use IE11 and are perhaps not aware of having Edge browser.

Is it possible to create a link in HTML which opens the website in Edge, if the user is on IE11 on Win10?

1 Answer 1

9

It's possible to open a URL in Edge Spartan thanks to microsoft-edge: protocol. This works in any browser on Windows 10. For example:

<a href="microsoft-edge:https://www.cnn.com">CNN</a>

Note however that this does not (yet?) work with Edge Chromium.

Checking if browser is IE11 on Windows 10 can be done for example as follows:

if (document.documentMode === 11 && navigator.userAgent.indexOf('Windows NT 10.0') > -1) {
    ...
}

If you want to create an Edge link to the current page (without hardcoding), you can do it with JavaScript:

myAnchor.href = 'microsoft-edge:' + document.URL;

Demo: https://jg-testpage.github.io/ie11/open-in-edge.html?foo=bar&baz=quux

2
  • I can see that you had posted the answer for your own question. I suggest you to mark that solution as an accepted answer for this thread after 24 hrs may help other community members in future who will have similar kind of question. Thanks for your understanding. Commented Dec 14, 2018 at 1:46
  • Thanks, this solution does solve my problem.
    – Derrick.X
    Commented Apr 22, 2022 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.