Growl Notifications: How to push Growl notifications from a website?

。_饼干妹妹 提交于 2019-12-13 16:11:20

问题


I'm wondering how I can push desktop Growl notifications from my web application to the user of my web application. I would like to use javascript, if possible, otherwise a language like Ruby or PHP would be my second choice.

Have you implemented something like this before? How can it be done?


回答1:


I figured out how to use Ruby to push Growl notifications. I would still like to find a JavaScript solution, but if there is no way to use JavaScript, then here is a Ruby solution:

Use the ruby-growl gem:

gem install ruby-growl

Then in your Ruby script:

require 'ruby-growl'
g = Growl.new "localhost", "ruby-growl", ["ruby-growl Notification"]
g.notify "ruby-growl Notification", "It Came From Ruby-Growl", "Greetings!"

Also, in order for this to work, you have to enable "Listen for incoming notifications" and "Allow remote application registration" on the Network tab of the Growl Preference Pane




回答2:


You can send Growl notifications from Javascript (with a bit of Flash as a helper, but that part is behind the scenes). Here is a test page: http://www.growlforwindows.com/gfw/examples/js/

Note that this only currently works on Windows - the Javascript/Flash support in Growl on the Mac is currently broken as noted here: https://groups.google.com/forum/?fromgroups=#!topic/growl-development/BNF8tcUE1kM



来源:https://stackoverflow.com/questions/6537558/growl-notifications-how-to-push-growl-notifications-from-a-website

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!