当前位置: 动力学知识库 > 问答 > 编程问答 >

Style native JavaScript Notification

问题描述:

I was browsing MDN and noticed there's now native JS support for a desktop notification, but did not see an option to style it. (I realize it is not widely supported yet.)

Is that option available?

I do see in the spec that there are some properties, such as body, icon, and tag that we can pass through as options, but it doesn't look like we can pass HTML into them and have it compiled. I do see that they only accept strings, but was wondering if someone has figured out a way to style it that I haven't.

dictionary NotificationOptions {

NotificationDirection dir = "auto";

DOMString lang = "";

DOMString body;

DOMString tag;

DOMString icon;

};

Use case: passing in a URL and allowing the user to click on the URL.

Here's the fiddle I have been playing around with.

Not a dire need, just more of a curious question.

网友答案:

It would seem logical to treat it like an alert box, since it is also a popup. The alert box is a system object which cannot be styled and does not interpret the text as HTML.

分享给朋友:
您可能感兴趣的文章:
随机阅读: