Webkit HTML 通知中的表单?
是否可以在 Webkit HTML 桌面通知中使用表单元素?我尝试从 Chrome 扩展程序打开 HTML 通知,并且出现我添加的 ,但我无法输入内容。我希望能够捕获其中的输入并保存它。
var notification = webkitNotifications.createHTMLNotification(chrome.extension.getURL('input-prompt.html'));
notification.show();
<html>
<body>
<form><input type="text" name="here" value="test" /></form>
</body>
</html>
Is it possible to use form elements in Webkit HTML desktop notifications? I'm tried to open a HTML notification from a Chrome extension, and the <input>
I added appears, but I cannot type in it. I'd like to be able to capture the input from it and save it.
var notification = webkitNotifications.createHTMLNotification(chrome.extension.getURL('input-prompt.html'));
notification.show();
<html>
<body>
<form><input type="text" name="here" value="test" /></form>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过一种非常简单的方式解决这个问题。您可以创建一个用作输入框的 div,并允许编辑该 div 的内容 (看这里)。然后你可以使用一个按钮或另一个div作为提交按钮,然后用javascript处理表单提交。
虽然我同意桌面通知可能不应该包含表单,但我有一个情况,在通知中包含表单实际上更方便。我希望这有帮助。
You can get around this in a pretty simple way. You can create a div that serves as your input box, and allow the content of the div to be edited (look here). Then you can use a button or another div as the submit button, then handle the form submit with javascript.
While I agree that desktop notifications are probably not meant to contain forms, I have a case where having a form in the notification is actually more convenient. I hope this helps.
通知并不用于交互。他们的目的是通知。
如果您想实现互动,请使用操作反而。
Notifications are not meant for interactivity. They are meant to notify.
If you want to have interactivity, use an Action instead.