开发者

Form elements in a HTML5 Notification

I know that it is possible for an HTML5 Notification to display HTML, however if that HTML included form elements (buttons, selects, ect.), is it at all possible to interact with those inputs via javascript? An example would be to use the notification as a reminder UI, which would have a button to dismiss and one to snooze, and a select drop down to choose how long to snooze for. Is there any way to attach listeners to these elements within 开发者_运维技巧the notification's content?


The function createHTMLNotification() requires an URL as argument, so you can put anything you like in the linked HTML page, including JS.

I have not tested this, but there doesn't seem to be any limit.


Yes and No.

Yes, you can have buttons and links with event listeners bound to them to react to user's actions.

No, you can't have form elements like textareas, inputs, select, etc. 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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜