网站可以将焦点传递到浏览器的url字段吗? [英] Can a website pass focus to the browsers url field?

查看:52
本文介绍了网站可以将焦点传递到浏览器的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.

背景:我的(无鼠标)web应用程序在加载时会吸引焦点,因此键盘快捷键可以使用.用户要求可以通过按空格键轻松访问浏览器的网址栏.

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

即使不可能,我现在也可以回答.:)

推荐答案

不,您不能使用自己的代码来完成它.

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

尽管在大多数浏览器中,快捷方式是 Alt - D

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

这篇关于网站可以将焦点传递到浏览器的url字段吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆