开发者

Can a website pass focus to the browsers url field?

开发者 https://www.devze.com 2022-12-13 22:58 出处:网络
Can I create a piece of code for my website which focuses the browser url bar (field) so I can directly start typing in a new url?

Can I create a piece of code for my website which focuses the browser url bar (field) so I can directly start typing in a new url?

There could be for example a predefined hotkey which would execute this code.

Background: My (mouse-less) webapp steals the focus when loaded, so开发者_JAVA百科 keyboard shortcuts can work. Users requested a possibility to easily access the browser url bar by hitting the space key.

Even if it is not possible, I can answer now I tried anything possible. :)


Nope you can't do it with your own code.

In most browsers though, the shortcut is Alt-D

  • Internet Explorer: Alt-D, F6
  • Mozilla Firefox: Alt-D, F6, Ctrl-L
  • Google Chrome: Alt-D, F6, Ctrl-L
  • Opera: Alt-D, F8, Ctrl-L
  • Safari (Mac): Command-L
0

精彩评论

暂无评论...
验证码 换一张
取 消