如何在HTML超链接中指定Chrome浏览器?尝试前缀后报错求助
microsoft-edge:? Great question! Let's break down what's going on here and what your options are:
Why google-chrome:/chrome: isn't working
Unlike Edge, which has an officially supported and system-registered microsoft-edge: URL protocol prefix by default, Chrome does not come with a pre-registered google-chrome: or chrome: protocol on Windows (or most other OSes). That's exactly why you're seeing the error:
There is no program associated to perform the requested action.
Your system has no idea which app should handle that custom protocol, since Chrome doesn't set this up automatically during installation.
Is this request feasible?
Short answer: Not natively, without extra setup
You can't force a link to open in Chrome via a simple HTML prefix like Edge's, unless you or your users take additional steps:
- Manual protocol registration (admin/advanced users): On Windows, you could manually add registry entries to associate
google-chrome:with the Chrome executable. For example, you'd add keys underHKEY_CLASSES_ROOT\google-chromepointing tochrome.exe "%1". This works, but it's not something you can rely on for general users (especially in email, where recipients won't have this setup). - Set Chrome as default browser: If Chrome is the user's default browser, regular
http:///https://links will open in Chrome automatically. But this is a user-controlled setting—you can't enforce it via HTML in an email.
Alternative workarounds for your localhost program link
Since you're linking to a local program/localhost service, here are a couple of practical alternatives:
- Use a regular
http://localhost:...link: If Chrome is the default browser, this will open there. If not, you can add a note in the email like "If this doesn't open in Chrome, copy the link and paste it into your Chrome address bar". - Chrome App/Shortcut (for internal use): If this is for an internal team, you could package the localhost service as a Chrome App or create a desktop shortcut that launches Chrome directly to that URL. Then you can share the shortcut (though this doesn't work directly in email).
内容的提问来源于stack exchange,提问作者conjenks

