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

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

        如何将焦点放在创建桌面通知的 Chrome 选项卡上?

        How to get focus to a Chrome tab which created desktop notification?(如何将焦点放在创建桌面通知的 Chrome 选项卡上?)

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

                <bdo id='zvMWe'></bdo><ul id='zvMWe'></ul>
                <tfoot id='zvMWe'></tfoot>

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

                • <legend id='zvMWe'><style id='zvMWe'><dir id='zvMWe'><q id='zvMWe'></q></dir></style></legend>
                  本文介绍了如何将焦点放在创建桌面通知的 Chrome 选项卡上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想实现与现在的 Gmail 相同的功能.当新电子邮件到达或新聊天出现时,会出现通知弹出窗口,如果您单击它,Gmail 的标签就会成为焦点.

                  I would like to implement same functionality as Gmail has nowadays. When new email arrives or new chat comes, notification popup appears and if you click it, the tab with Gmail gets focussed.

                  我有这个代码:

                  var n = window.webkitNotifications.createNotification('ico.gif', 'Title', 'Text');
                  n.onclick = function(x) { this.cancel(); };
                  n.show();
                  

                  当我单击通知时,它会消失.现在我需要向 onclick 函数添加一些代码,以调出并聚焦创建此通知的页面.我知道这是可能的,因为 GMail 做得很好.但我没有成功调查 Gmail 来源(它们被最小化和混淆了).

                  When I click notification it makes it just disappear. Now I need to add some code to onclick function to bring up and focus page that created this notification. I know it is possible because GMail does it very well. But I didn't succeed in looking into Gmail sources (they are minimalized and obfuscated).

                  有人知道怎么做吗?

                  推荐答案

                  你可以把 window.focus() 放到谷歌浏览器中.单击时它将聚焦到该窗口.

                  You can just place window.focus() in Google Chrome. It will focus to that window when clicked.

                  var n = window.webkitNotifications.createNotification('ico.gif', 'Title', 'Text');
                  n.onclick = function(x) { window.focus(); this.close(); };
                  n.show();
                  

                  我在 Gmail 中打开了检查器,添加了上面的代码,移动到另一个选项卡,然后运行它.通知出现了,点击后,我又回到了 Gmail.

                  I opened the inspector in Gmail, added the above code, moved to a different tab, and ran it. The notification appeared and once clicked, it brought me back to Gmail.

                  这篇关于如何将焦点放在创建桌面通知的 Chrome 选项卡上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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(更改链接悬停时的背景图像)
                  css menu hover quot;hangsquot; in chrome amp; safari(css 菜单悬停“挂起在铬 amp;苹果浏览器)

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

                  <tfoot id='vmyB7'></tfoot>

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

                              <tbody id='vmyB7'></tbody>