<tfoot id='Ztjfs'></tfoot>
  • <legend id='Ztjfs'><style id='Ztjfs'><dir id='Ztjfs'><q id='Ztjfs'></q></dir></style></legend>
      • <bdo id='Ztjfs'></bdo><ul id='Ztjfs'></ul>
      <i id='Ztjfs'><tr id='Ztjfs'><dt id='Ztjfs'><q id='Ztjfs'><span id='Ztjfs'><b id='Ztjfs'><form id='Ztjfs'><ins id='Ztjfs'></ins><ul id='Ztjfs'></ul><sub id='Ztjfs'></sub></form><legend id='Ztjfs'></legend><bdo id='Ztjfs'><pre id='Ztjfs'><center id='Ztjfs'></center></pre></bdo></b><th id='Ztjfs'></th></span></q></dt></tr></i><div id='Ztjfs'><tfoot id='Ztjfs'></tfoot><dl id='Ztjfs'><fieldset id='Ztjfs'></fieldset></dl></div>
    1. <small id='Ztjfs'></small><noframes id='Ztjfs'>

        如何为将 gmail 作为默认邮件处理程序的用户在新选项卡中打开 mailto 链接?

        How to open mailto links in new tab for users that have gmail as the default mail handler?(如何为将 gmail 作为默认邮件处理程序的用户在新选项卡中打开 mailto 链接?)

          <tbody id='uK0bN'></tbody>
        <i id='uK0bN'><tr id='uK0bN'><dt id='uK0bN'><q id='uK0bN'><span id='uK0bN'><b id='uK0bN'><form id='uK0bN'><ins id='uK0bN'></ins><ul id='uK0bN'></ul><sub id='uK0bN'></sub></form><legend id='uK0bN'></legend><bdo id='uK0bN'><pre id='uK0bN'><center id='uK0bN'></center></pre></bdo></b><th id='uK0bN'></th></span></q></dt></tr></i><div id='uK0bN'><tfoot id='uK0bN'></tfoot><dl id='uK0bN'><fieldset id='uK0bN'></fieldset></dl></div>
          <bdo id='uK0bN'></bdo><ul id='uK0bN'></ul>
          • <small id='uK0bN'></small><noframes id='uK0bN'>

            <tfoot id='uK0bN'></tfoot>

              • <legend id='uK0bN'><style id='uK0bN'><dir id='uK0bN'><q id='uK0bN'></q></dir></style></legend>

                1. 本文介绍了如何为将 gmail 作为默认邮件处理程序的用户在新选项卡中打开 mailto 链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在网页上的 mailto 链接打开默认的电子邮件客户端.现在 Chrome 提供了将 Gmail 设置为默认电子邮件客户端的功能,一些用户会在同一窗口中打开链接,从而使他们离开点击链接的页面(他们不喜欢)

                  On a web page mailto links open the default e-mail client. Now that Chrome offers the ability to set Gmail as the default e-mail client, some users have the links open in the same window thus taking them away from the page they clicked the link (which they do not like)

                  我尝试将目标 _blank 添加到链接,这对 gmail 用户非常有用,但会让 Outlook 用户发疯,因为每次点击 mailto 链接时都会打开一个新的空白选项卡.

                  I have tried adding target _blank to the links, which works great for gmail users, but will drive Outlook users mad, because a new blank tab will open every time they click a mailto link.

                  我有办法检测默认电子邮件处理程序并为这两种类型的用户提供良好的体验吗?

                  I there a way to detect the default e-mail handler and offer a good experience for both types of users?

                  推荐答案

                  好的,所以我能够在 Mac 上的 Chrome 中使用它.你的旅费可能会改变.此外,这对 IMO 来说是很老套的,所以它可能不值得.老实说,这应该作为 Chrome 中的设置存在,并且应该将行为委托给网站.例如.Chrome 应该有一个选项:[x] 始终在单独的选项卡中打开 mailto 链接"

                  Okay, so I was able to get this working in Chrome on Mac. Your mileage may vary. Also, this is pretty hacky IMO, so it may not be worth it. Honestly this should exist as a setting within Chrome, and the behavior should be delegated to the website. E.g. Chrome should have an option: "[x] Always open mailto links in separate tab"

                  话虽如此,这就是你的做法.

                  That being said, here's how you do it.

                  首先像这样构建你的链接:

                  First construct your links like so:

                  <a href="#" data-mailto="somebody@email.com">Mail Somebody</a>
                  

                  然后为这些设置一个点击处理程序.

                  Then set a click handler for those.

                  $('a[data-mailto]').click(function(){
                    var link = 'mailto.html#mailto:' + $(this).data('mailto');
                    window.open(link, 'Mailer');
                    return false;
                  });
                  

                  window.open 有一个可选的 options 参数,您可以对其进行调整.事实上,我几乎会推荐它,看看你是否可以让生成的窗口尽可能不引人注目.https://developer.mozilla.org/en/DOM/window.open

                  There is an optional options argument to window.open that you can tweak. In fact I would almost recommend it, to see if you can get the generated window to be as unnoticable as possible. https://developer.mozilla.org/en/DOM/window.open

                  http://www.w3schools.com/jsref/met_win_open.asp(MDN 文档详尽无遗,而 w3schools 文档几乎更容易阅读)

                  http://www.w3schools.com/jsref/met_win_open.asp (the MDN doc is exhaustive, while the w3schools doc is almost easier to read)

                  接下来我们需要创建mailto.html 页面.现在您可能需要使用下面看到的超时.您甚至可以将其设置为非常短的值,例如 500 毫秒.

                  Next we need to create the mailto.html page. Now you may need to play around with the timeout you see below. You could probably even set this to something really short like 500ms.

                  <html>
                  <script>
                  function checkMailto(hash){
                      hash = hash.split('mailto:');
                      if(hash.length > 1){
                          return hash[1];
                      } else {
                          return false;
                      }
                  }
                  
                  var mailto = checkMailto(location.hash);
                  
                  if(mailto){
                      location.href = 'mailto:'+mailto;
                      setTimeout(function(){
                        window.close();
                      }, 1000);
                  }
                  </script>
                  </html>
                  

                  结果

                  Mail.app 设置为我的默认电子邮件阅读器:

                  当我单击该链接时,它会在瞬间打开一个窗口,然后撰写一条空白消息.在浏览器中它会返回到原始页面.

                  When I click the link, it opens a window for a split second, then composes a blank message. In the browser it goes back to the original page.

                  在设置">高级">隐私">处理程序"下将 Gmail 设置为邮件阅读器:

                  当我点击该链接时,它会打开一个新的 Gmail 标签页,上一页安全地位于它自己的标签页中.

                  When I click the link, it opens a new tab to Gmail, with the previous page safely in it's own tab.

                  注意:一旦您将 Gmail 设置为您的电子邮件处理程序,在操作系统端(至少在 mac 上),Chrome 将被设置为系统的电子邮件处理程序.因此,即使您在 Chrome 中关闭 Gmail 作为电子邮件处理程序,它仍然是在操作系统级别设置的.所以要重置它,我去了邮件>首选项>常规.并将默认邮件阅读器设置回邮件.

                  Note: Once you set Gmail as your email handler, on the OS side (at least on mac), Chrome is set as the system's email handler. So even if you turn off Gmail as the email handler inside Chrome, it is still set on the OS level. So to reset that, I went to Mail > Prefs > General. And set default mail reader back to Mail.

                  这篇关于如何为将 gmail 作为默认邮件处理程序的用户在新选项卡中打开 mailto 链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Gradient Button to background-color blinks on hover(悬停时背景颜色的渐变按钮闪烁)
                  How to make hovering over active button not use hover effect?(如何使悬停在活动按钮上不使用悬停效果?)
                  html javascript show image hover(html javascript 显示图像悬停)
                  How to get css hover values on click?(如何在点击时获得 css 悬停值?)
                  Change background image on link hover(更改链接悬停时的背景图像)
                  Highlight multiple items on hover#39;s condition(突出显示悬停条件下的多个项目)

                  <i id='ASO1X'><tr id='ASO1X'><dt id='ASO1X'><q id='ASO1X'><span id='ASO1X'><b id='ASO1X'><form id='ASO1X'><ins id='ASO1X'></ins><ul id='ASO1X'></ul><sub id='ASO1X'></sub></form><legend id='ASO1X'></legend><bdo id='ASO1X'><pre id='ASO1X'><center id='ASO1X'></center></pre></bdo></b><th id='ASO1X'></th></span></q></dt></tr></i><div id='ASO1X'><tfoot id='ASO1X'></tfoot><dl id='ASO1X'><fieldset id='ASO1X'></fieldset></dl></div>
                2. <tfoot id='ASO1X'></tfoot>
                        <tbody id='ASO1X'></tbody>
                        <bdo id='ASO1X'></bdo><ul id='ASO1X'></ul>

                          <small id='ASO1X'></small><noframes id='ASO1X'>

                          <legend id='ASO1X'><style id='ASO1X'><dir id='ASO1X'><q id='ASO1X'></q></dir></style></legend>