Chrome 扩展程序中类似“Toast”的警报
我正在尝试
alert("Success!");
用类似于 Android 风格的 toast 的内容替换以下行:(意思是,页面上某处的不间断成功消息)。对于这个问题有很多 JQuery 解决方案(请参阅此处),但是我在从 Chrome 扩展程序后台页面使用它们时遇到问题。
我也尝试过将它注入到当前页面中,但这并不简单,也不起作用(因为我需要注入 JQuery,然后是插件,然后我调用插件),这变得有点荒谬。
有什么想法吗?
I am trying to replace the following line:
alert("Success!");
with something similar to Android-style toasts (Meaning, a non-interruptive success message somewhere on the page). There are many JQuery solutions for this problem (see here), however I am having trouble using them from a Chrome Extension background page.
I have also tried injecting it into the current page, but this is not simple and also not working (because I need to inject JQuery, then the plugin, then me calling the plugin) and this becomes a little ridiculous.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
桌面通知似乎仍然是最好的,但是答案中的链接已损坏。
下面是如何从 Chrome 扩展程序创建基本桌面通知的工作示例,以及更多文档的链接:
更多信息:https://developer.chrome.com/docs/extensions/reference/notifications/
Desktop Notifications still seem to be best, however the link in the answer is broken.
Below is a working example of how to create a basic Desktop Notification from a Chrome Extension and a link to the docs for more:
More here: https://developer.chrome.com/docs/extensions/reference/notifications/
使用桌面通知。
Use desktop notifications.