javascript - Chrome 错误解决方法 : Javascript to steal focus

标签 javascript google-chrome focus

当我启动 Chrome 时,新窗口显示为未聚焦并位于其他窗口后面。所以我决定创建一个解决方法;我将使用磁盘中的一个文件更改我的主页网址,该文件包含用于窃取焦点的 JavaScript,然后重定向到真实主页。

使用 JavaScript 窃取焦点的最佳方法是什么?

更新:这是我尝试过的...

  <html>
     <head></head>
     <body></body>
  </html>

  <script type="text/javascript">

       myWindow=window.open("http://google.com", "_blank", 
          "resizable=yes, scrollbars=yes, titlebar=yes" );
       myWindow.focus();
       self.close();

   </script>

但是新窗口看起来像弹出窗口,Chrome 不显示工具栏且地址栏不可编辑:(


有关该错误的更多信息: http://productforums.google.com/forum/#!topic/chrome/zyLC4Ip96pU

As far as I'm aware, this has only started on the latest update. If Chrome is already open, when I open a new window of Chrome from a shortcut in the quick launch area of my Windows toolbar, the new window does not take focus, the focus remains on the previous Chrome window. If the focus was not on the previous Chrome window when I launch the shortcut it works fine

最佳答案

我刚刚发布了一个小型 Chrome 扩展,旨在解决这个错误!到目前为止,它对我来说效果很好(在 Window 7 64 位上)。 您可以在这里找到它:https://chrome.google.com/webstore/detail/chrome-new-window-focus/opmhcfhkhiodgapmnaolhmekmfihmecp

如果您遇到任何问题,请告诉我!

干杯,
尤维

关于javascript - Chrome 错误解决方法 : Javascript to steal focus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11735834/

相关文章:

javascript - jQuery 添加到 css 元素

css - 输入类型密码破坏了 Chrome 和 Opera 中的布局

wpf - 选择选项卡项内容时如何聚焦 WPF 选项卡项?

Winapi:使用 EnableWindow() 函数时窗口为 "sent to back"

javascript - jQuery 的多个 div 创建/销毁错误

javascript - 在 React Native 中创建 'Div' 和 'Span' 组件

javascript - 将对象保持在边界内

google-chrome - 是否有键盘快捷键可以取消焦点/模糊事件表单字段?

ios - 带有 http 请求的 https 适用于 ios 移动设备,而不是桌面设备?

java - swing默认选择文本