Html Mailto 链接在 Chrome 中什么都不做,但在 Firefox 中有效?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17517600/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Mailto links do nothing in Chrome but work in Firefox?
提问by Crashalot
It seems like the mailto
links we're embedding in our website fail to do anything in Chrome, though they work in Firefox.
mailto
我们在网站中嵌入的链接似乎在 Chrome 中无法执行任何操作,尽管它们在 Firefox 中有效。
Simple example here: http://jsfiddle.net/wAPNH/
这里的简单示例:http: //jsfiddle.net/wAPNH/
<a href='mailto:[email protected]'>hi this is a test</a>
Do we need to do something special to enable mail links in Chrome?
我们需要做一些特别的事情来在 Chrome 中启用邮件链接吗?
采纳答案by kennypu
This is browser settings specific, i.e. it will behave differently depending on the user's browser settings. The user can change how mailto:
links behave in chrome by visiting chrome://settings/handlers
, or Chrome Settings->Content Settings->Manage Handlers...
这是特定于浏览器设置的,即它会根据用户的浏览器设置而有所不同。用户可以mailto:
通过访问chrome://settings/handlers
,或Chrome Settings->Content Settings->Manage Handlers...
If "email" is not listed on that page, then see this answerregarding how to proceed.
如果该页面上未列出“电子邮件”,请参阅有关如何继续的答案。
回答by Rajesh Hegde
This is because chrome handles the mailto in different way. You can go to chrome://settings/handlers
and make sure that which is the default handler. In your case it will be none (i.e. not listed). Now go to gmail.com. You should see something like this when you click on the button beside the bookmark button.
这是因为 chrome 以不同的方式处理 mailto。您可以转到chrome://settings/handlers
并确保哪个是默认处理程序。在您的情况下,它将是无(即未列出)。现在去 gmail.com。当您单击书签按钮旁边的按钮时,您应该会看到类似的内容。
If you wish to open all email links through gmail then set "Use Gmail". Now when you click on mailto button, chrome will automatically opens in gmail.
如果您希望通过 Gmail 打开所有电子邮件链接,请设置“使用 Gmail”。现在,当您单击 mailto 按钮时,chrome 将自动在 gmail 中打开。
回答by SamHymanSon
In my case, chrome was associated as MAILTOprotocol in Windows 10.
就我而言,chrome 与Windows 10 中的MAILTO协议相关联。
I changed the association to Outlook using "Default Programs"-> "Associate a file type or protocol with a program".
我使用“默认程序”-> “将文件类型或协议与程序相关联”更改了与 Outlook 的关联。
MAILTO is way below in the list. This screenshot may help.
MAILTO 在列表的下方。此屏幕截图可能会有所帮助。
回答by rrudland
I also experienced this issue, and eventually tracked it down to the fact that my link was within an iframe, and my web app uses https. Chrome was blocking it due to this (Chrome would open other mailto links outside of the iframe).
我也遇到过这个问题,并最终将其归结为我的链接在 iframe 中,而我的 Web 应用程序使用 https。由于这个原因,Chrome 阻止了它(Chrome 会打开 iframe 之外的其他 mailto 链接)。
In mailto link not working within a frame chrome (over https), kendsnyder mentioned simply changing
在mailto 链接中无法在框架 chrome (over https) 内工作,kendsnyder 提到只是改变
<a href="mailto:...">email</a>
to
到
<a target="_top" href="mailto:...">email</a>
Voila, problem solved. That mailto link now works in all browsers.
瞧,问题解决了。该 mailto 链接现在适用于所有浏览器。
回答by jj_
回答by Yuriy Galanter
You can try going to chrome://settings/handlers
and set value for mailto:
to none
instead of gmail
你可以试着去chrome://settings/handlers
和设定值mailto:
来none
代替gmail
回答by Benn
Fix that worked for me since my Protocol handlers was empty
修复对我有用,因为我的协议处理程序是空的
https://productforums.google.com/forum/#!topic/gmail/CQMCGRvyhCM
https://productforums.google.com/forum/#!topic/gmail/CQMCGRvyhCM
See redfish43 reply , to sum up
看redfish43回复,总结一下
For mailto: - Make sure you are logged in to Gmail and the active window is your main Gmail page (or nothing will happen). - Copy/paste this into the address bar:
对于 mailto: - 确保您已登录 Gmail 并且活动窗口是您的 Gmail 主页面(否则什么也不会发生)。- 将其复制/粘贴到地址栏中:
javascript:navigator.registerProtocolHandler("mailto","https://mail.google.com/mail/?extsrc=mailto&url=%s","Gmail")
Add the javascript: to the front again if needed, because when you pasted it, Chrome probably trimmed everything before and including the colon. Then hit enter.
如果需要,再次将 javascript: 添加到前面,因为当您粘贴它时,Chrome 可能会修剪掉前面的所有内容,包括冒号。然后按回车。
When popup window opens click on "Allow"
当弹出窗口打开时点击“允许”
回答by Jes
I had the same problem. The problem, by some strange reason Chrome turned himself as the default tool to open a mailto: link. The solution, put your mail client as the default app to open it. How to : http://windows.microsoft.com/en-nz/windows/change-default-programs#1TC=windows-7
我有同样的问题。这个问题,出于某种奇怪的原因,Chrome 将自己变成了打开 mailto: 链接的默认工具。解决方案,将您的邮件客户端作为默认应用程序打开它。如何:http: //windows.microsoft.com/en-nz/windows/change-default-programs#1TC=windows-7
Good luck
祝你好运
回答by Mach1
I found this answer on a Google forum that has worked me. In the footnotes it mentions 'googleapps.exe' - I don't have this and it has still worked. Simply follow the instructions below but close down all applications before making changes to the Registry. Also I saved the existing value just in case it didn't work.
我在对我有用的 Google 论坛上找到了这个答案。在脚注中它提到了“googleapps.exe”——我没有这个,它仍然有效。只需按照以下说明进行操作,但在更改注册表之前关闭所有应用程序。我还保存了现有值,以防万一它不起作用。
Simply type "run" in your search bar, then type "regedit" then travel to:
只需在搜索栏中输入“run”,然后输入“regedit”,然后前往:
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\mailto\shell\open\command\
edit (double click) "(Default)" to:
编辑(双击)“(默认)”为:
"C:\Program Files (x86)\Google\Google Apps\googleapps.exe" --domain= --mailto.google.com="%1"
That's it! Save and close it and it should work beautifully!
就是这样!保存并关闭它,它应该可以正常工作!
Using this method prevents you from having to download the GMail Notifier, which for those of us with GTalk don't need since it does it for us. I'm not sure why Google can't solve this issue easily.. i've heard Google Apps haven't been tested fully on Windows 7 but it's obvious the same tag works with it.
使用此方法可以防止您必须下载 GMail 通知程序,对于我们这些使用 GTalk 的人来说不需要,因为它为我们完成了。我不确定为什么 Google 不能轻易解决这个问题。我听说 Google Apps 尚未在 Windows 7 上进行全面测试,但很明显相同的标签可以与它一起使用。
Note: The only thing with this solution is you need to have the googleapps.exe file on your machine. I believe I got it with my free GooglePack from their site which has now been discontinued. I tried searching the net for a way to download it but weirdly enough it seems it's reserved only for Businesses now and there is no download link available from the web because everyone who has it streamed it using the google updater.. Odd. Anyway good luck!
注意:此解决方案的唯一问题是您的计算机上需要有 googleapps.exe 文件。我相信我是用我的免费 GooglePack 从他们的网站上得到的,现在已经停产了。我尝试在网上搜索下载它的方法,但奇怪的是,它现在似乎仅供企业使用,而且网上没有可用的下载链接,因为每个拥有它的人都使用谷歌更新程序流式传输它......奇怪。总之祝你好运!
回答by fenix
Another solution is to implement your own custom popup/form/user control that will be universally interpreted across all browsers.
另一种解决方案是实现您自己的自定义弹出/表单/用户控件,这些控件将在所有浏览器中通用解释。
Granted this will not leverage the "mailto" out of the box capabilities. It all depends on what availability adherence you are working against. Unfortunately for myself - the mailto needed to be available to everyone by default without "inconveniencing the client".
当然,这不会利用“mailto”开箱即用的功能。这完全取决于您所针对的可用性遵守情况。对我来说不幸的是 - 默认情况下,mailto 需要对所有人可用,而不会“给客户带来不便”。
Your decision ultimately.
你的最终决定。