Home > Software design >  Replace redirect from Microsft Edge to Google Chrome in HTML
Replace redirect from Microsft Edge to Google Chrome in HTML

Time:02-02

in this piece of HTML code

<a href="microsoft-edge:https://www.ansa.it">PARTECIPA</a>

the opening of the website in the Microsoft Edge browser is indicated if installed on the device.

Can anyone help me? I would like the site to open in Google Chrome and not in Edge. How should I edit this HTML?

CodePudding user response:

This function does not work! A similar example is for IOS, which works in the following way

Example :

<a href="googlechromes://www.ansa.it">PARTECIPA</a>

CodePudding user response:

Google has official documentation on the Chrome iOS app’s URI scheme on its developer website.

Simply replace http with googlechrome and https with googlechromes. This means:

http://www.google.com/ becomes googlechrome://www.google.com/ https://apple.stackexchange.com/ becomes googlechromes://apple.stackexchange.com/ Previously, it supported an x-callback-url of googlechrome-x-callback://. This allowed the calling app to indicate its name and URI scheme to Chrome, which would show a back button in the address bar that closes the tab and invokes the specified URI. This feature was removed a few years ago when iOS 9 added the “Back to …” button in the status bar (but the URI scheme still works).

CodePudding user response:

To open the link using the Chrome browser instead of Microsoft Edge, you can change the value of href attribute like this: <a href="googlechrome:https://www.ansa.it">PARTECIPA</a>. Assuming that Chrome browser is installed, that should open the Chrome browser.

Problem:

If Edge is not installed on the device (mob, desk or tab) it doesn't work

In this case, it's best to simply use a standard URL without specifying a specific browser, like this. <a href="https://www.ansa.it">PARTECIPA</a>. In addition, the "googlechrome:" protocol is not a standardized protocol and probably may not work in all devices. So, you can use a standardized URL like the code snippet I posted above and let the users device choose.

Do you know if instead of chrome I can specify "default browser" Example PARTECIPA or something similar?

There is no standard protocol for specifying the default browser. So, best approach is to simply use a standard URL without specifying a specific browser. But if you really want to use special web protocols inside hypertext links to force web pages or files to open with particular browsers on Windows or iOS, place browser-name before the hypertext reference link.

Check this:

<a href="googlechrome:https://www.example.com">Open in Google Chrome</a>
<a href="microsoft-edge:https://www.example.com">Open in Microsoft Edge</a>
<a href="firefox:https://www.example.com">Open in Mozilla Firefox</a>
<a href="safari:https://www.example.com">Open in Apple Safari</a>
<a href="opera:https://www.example.com">Open in Opera</a>
  • Related