Web应用可以提供桌面通知吗? [英] Can a web app give desktop notification

查看:127
本文介绍了Web应用可以提供桌面通知吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,制作应用程序的一个小想法贯穿我的脑海。但这是我第一次尝试申请。到目前为止,我已经开始使用PHP,C ++,Ruby和Rails框架工作,但都处于初级阶段。

Well, A small idea of making an application ran through my mind. But this is the first time I would try to make an application. Till now I have worked on PHP, C++, Ruby with Rails frame work, but all at a beginner level.

我准备进行更大的飞跃并广泛学习它们如果我的想法要求如此。要求是Web应用程序为您提供桌面通知。我已经看到Gmail聊天框发生了这种情况。我需要知道的是,什么是正确的工具开始? PHP走得那么远吗?或者在Rails上工作会是更好的选择吗?另外,普通的初级程序员是否可以做这样的事情?制作这样的应用程序需要做些什么?

I am ready to take a bigger leap and learn them extensively if my idea demands so. The requirement is such that the web app gives you a desktop notification. I have seen that happen with a Gmail chat box. All I need to know is, what could be right tools to start with? Does PHP go that far? Or working on Rails would be a better option? Also, is it possible for an average beginner level programmer to do such a thing? What all does it take to make an app like that?

推荐答案

桌面通知不依赖于语言。没有服务器端语言可以在桌面上显示通知。您放在服务器上的内容并不重要,除非客户端支持此类通知API ,否则您无法将该通知放在桌面上。

The desktop notification is not language dependant. There is no server-side language that can make a notification appear on a desktop. It doesn't matter what you put on the server, you can't make that code put notifications on the desktop unless the client supports such a notification API.

客户端支持意味着必须在客户端上运行某种可以在桌面上放置通知对话框的应用程序。这是头号要求。

Client support means there has to be some sort of application running on the client that can put up the notification dialog on the desktop. This is the number one requirement.

如果您没有在客户端上运行任何有这种支持的东西,那么无论您在服务器上放置什么魔法(PHP, Ruby,Perl,...)客户端什么都不会发生。

If you don't have anything running on the client with such support, then no matter what magic you put on the server (PHP, Ruby, Perl, ...) nothing will ever happen on the client.

这就是为什么,正如你从KCiebiera的答案中看到的那样,可以可以通知Chrome和Firefox

That's why, as you see from the answer by KCiebiera, the clients that can make notifications possible are Chrome and Firefox.

您所做的是在客户端上运行代码(在本例中为Javascript),查找内容(消息)例如,来自服务器),然后指示浏览器(Chrome或Firefox)启动通知。

What you do is run code on the client (Javascript in this case), that looks for something (a message from the server for example), and then instructs the browser (Chrome or Firefox), to launch the notification.

这并不复杂。看看KCiebiera发布的教程,这应该可以帮助你开始。

It's not more complicated than that. Look at the tutorial KCiebiera posted, and that should get you started.

希望这有助于你更好地理解这个问题。

Hope this helps you understand the problem better.

这篇关于Web应用可以提供桌面通知吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆