Chrome 通知将自动焦点设置为文本框
尝试创建一个 HTML webkitNotifications,其中包含一个文本框,一旦创建通知,该文本框就会设置焦点。
似乎不起作用的事情
window.focus() 然后 document.getElementById("textbox").focus()
也 autofocus="autofocus" 效果不太好
Trying to create a HTML webkitNotifications with a textbox in it that has the focus on it set once the notification has been created.
Things that don't seem to work
window.focus()
then document.getElementById("textbox").focus()
also autofocus="autofocus"
does not work as well
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
webkitNotification 中不能包含文本区域、输入、选择等表单元素。这些元素将显示在通知中,但用户将无法与它们交互。我无法找到任何关于此的文档,但我猜测这是由于通知应该保持简单的想法。
You can't have form elements like textareas, inputs, select, etc. in a webkitNotification. The elements will show up in the notification but the user will not be able to interact with them. I haven't been able to find any documentation on this but I'm guessing that it is due to the idea that notifications should be kept simple.