让 Gmail 处理所有 mailto - 包含 registerProtocolHandler 的链接
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
如果您使用 Gmail,可能会无意中点击某个 mailto:
链接而感到沮丧,此时您的 Outlook 或邮件的桌面客户端将会启动。
多亏 navigator.registerProtocolHandler()
(我们之前介绍过),您可以将 Gmail 作为 Chrome 和 Firefox 中所有 mailto:
链接的默认邮件客户端。
具体方法如下:
- 首先,打开一个 Gmail 标签页。您必须通过 Gmail 标签页(而不是 html5rocks 标签页)执行此操作。:)
- 打开 JavaScript 控制台(Mac 上为
cmd-opt-j
,Windows 上为 ctrl-shift-j
),然后输入:
navigator.registerProtocolHandler("mailto", "https://mail.google.com/mail/?extsrc=mailto&url=%s", "Gmail");
- 接受浏览器的确认。
- 点击此 mailto: 链接来测试您的新 Gmail mailto 连接!
好棒。尽情享受吧!
如果您需要移除此设置,可以在 Chrome 中的 chrome://settings/handlers
和 Firefox 中的 Preferences->Applications->mailto
执行此操作。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2012-02-07。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"没有我需要的信息"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"太复杂/步骤太多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"内容需要更新"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/代码问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]