Chrome 通知将自动焦点设置为文本框

发布于 2024-12-21 19:08:11 字数 196 浏览 6 评论 0原文

尝试创建一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浅黛梨妆こ 2024-12-28 19:08:11

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文