简体   繁体   English

反应中的网站图标/标签通知

[英]Favicon / tab notifications in react

I'd like to add notifications to my favicon when my window tab is blurred.当我的窗口选项卡模糊时,我想向我的网站图标添加通知。 I'm using react and material ui (using typescript).我正在使用 react 和 material ui(使用打字稿)。

I could imagine that it is a very common use case but I can't seem to find an easy solution out there.我可以想象这是一个非常常见的用例,但我似乎无法找到一个简单的解决方案。 Any suggestions?有什么建议?

Can you create a version of your icon that contains a notification indicator and then change the favicon using:您可以创建一个包含通知指示器的图标版本,然后使用以下方法更改图标:

document.querySelector("link[rel*='icon']").href = "favicon.ico"; ? ?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM