简体   繁体   English

创建在Web浏览器上运行的桌面应用程序

[英]Creating Desktop applications that run on web browser

In the last year I got to know that many developers started developing desktop applications that run on the web browser. 去年,我知道许多开发人员开始开发在Web浏览器上运行的桌面应用程序。

I am also trying to get into it and I'm trying to understand how I should start with such kind of development. 我也尝试着进入它,并且试图理解我应该如何开始这种发展。

I first thought I should create a regular client-server application, ie with Apache Tomcat or with PHP, and for each launch of an application, to launch a new server on localhost and to open a browser that will load the application. 我首先想到我应该创建一个常规的客户端服务器应用程序,即使用Apache Tomcat或PHP,并为每次启动应用程序在本地主机上启动新服务器并打开将加载该应用程序的浏览器。

I've lately got to know that there are packages that do the server-client work for you, such as node-webkit. 我最近才知道有些软件包可以为您完成服务器-客户端的工作,例如node-webkit。

I don't know where to start and I'm very confused... 我不知道从哪里开始,我很困惑。

When developers say that they develop desktop applications in Javascript or such that run on web browser - do they probably mean that the use node-webkit? 当开发人员说他们使用Javascript或在Web浏览器上运行的桌面应用程序进行开发时,是否可能意味着使用node-webkit? Or does they do the complex structure I described above (JSP/PHP server on localhost) ? 还是它们执行我上面描述的复杂结构(本地主机上的JSP / PHP服务器)?

The selection of technologies for building an application depends on the use of your application and the platform you want it to run on. 构建应用程序的技术选择取决于应用程序的使用以及您希望其运行的平台。

Web applications in contrast to Desktop applications are hosted and served by servers (like Tomcat) which are then requested and present to you by your browser. 与桌面应用程序相反,Web应用程序由服务器(例如Tomcat)托管和提供服务,然后由浏览器请求并向您提供这些服务器。

Desktop applications are running on your local machine and they are independent from your browser. 桌面应用程序正在本地计算机上运行,​​并且独立于浏览器。 However node webkit, allows you to design applications using HTML and making them dynamic using node. 但是,node webkit允许您使用HTML设计应用程序,并使用node使它们动态化。 The end result is a standalone application that runs as a browser emulation that is able to render and run software based on HTML and javascript. 最终结果是一个独立的应用程序,该应用程序作为浏览器仿真运行,能够呈现和运行基于HTML和javascript的软件。 (In this case nodejs serves the application locally and the standalone web-app is the client). (在这种情况下,nodejs在本地为应用程序提供服务,而独立的Web应用程序为客户端)。

Long story short node-webkit emulates the client-server model that is used for classic web apps, to build desktop applications. 长话短说节点Webkit模拟了用于经典Web应用程序的客户端-服务器模型,以构建桌面应用程序。

It is an unorthodox way for doing things IMHO, but it might be a good start for getting into application development. 这是做恕我直言的非常规方法,但它可能是进入应用程序开发的良好起点。

Many development models with web technologies exist, but they have different purposes and it all depends on what you want to do. 存在许多使用Web技术的开发模型,但是它们具有不同的目的,并且都取决于您要执行的操作。

You seem to be mixing 3 models 您似乎在混3个模型

Classic websites 经典网站

A server (with PHP, Java or whatever) generates HTML. 服务器(使用PHP,Java或其他工具)会生成HTML。

A user uses a browser to access it. 用户使用浏览器进行访问。

When the user clicks somewhere, the server is called again and generates another HTML file. 当用户单击某处时,将再次调用服务器并生成另一个HTML文件。

Single Page Applications 单页应用

This model is often used when writing websites that need a lot of interactivity. 当编写需要大量交互的网站时,通常使用此模型。 For example Gmail, or Google docs are SPAs (more or less). 例如,Gmail或Google文档是SPA(或多或少)。

SPAs are websites (you can access them at an URL) where all templating is done client side, and the webserver only exposes a HTTP API. SPA是网站(您可以在URL上访问它们),其中所有模板都在客户端完成,并且Web服务器仅公开HTTP API。

Most of the times, people use frameworks to make those like: 大多数时候,人们使用框架来实现以下目的:

  • AngularJS AngularJS
  • React 应对
  • Backbone 骨干

Desktop apps with web technologies 具有Web技术的桌面应用

That's just coding an application that you can install on a computer or phone with web technologies (javascript, css, html). 那只是编码一个应用程序,您可以使用网络技术(javascript,css,html)将其安装在计算机或电话上。

There is no server. 没有服务器。

Tools that enable programmers to do this are 使程序员能够执行此操作的工具是

  • Node webkit (for desktops) 节点Webkit(用于台式机)
  • Cordova (for phones) 科尔多瓦(用于手机)
  • Many others 很多其他的

Most of the time, programmers also use SPA tools in conjonction with those to help them during development 多数时候,程序员还将SPA工具与那些在开发过程中提供帮助的工具结合使用

Try this- 尝试这个-

https://electronjs.org/ https://electronjs.org/

Build cross platform desktop apps with JavaScript, HTML, and CSS. 使用JavaScript,HTML和CSS构建跨平台的桌面应用程序。 With Electron, creating a desktop application for your company or idea is easy. 使用Electron,可以轻松为您的公司或想法创建桌面应用程序。 Initially developed for GitHub's Atom editor, Electron has since been used to create applications by companies like Microsoft, Facebook, Slack, and Docker. Electron最初是为GitHub的Atom编辑器开发的,此后被Microsoft,Facebook,Slack和Docker等公司用于创建应用程序。

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

相关问题 检测Web应用程序和桌面应用程序中的漏洞 - detecting vulnerabilities in web applications and desktop applications 一个好的跨浏览器JavaScript库,用于构建桌面/操作系统样式的Web应用程序? - a good cross browser javascript library for building desktop/os styled web applications? 从浏览器打开带有 javascript 的桌面应用程序 - Open desktop applications with javascript from the browser 使用Web技术创建桌面应用程序 - Using web technologies to create desktop applications Node.js 是否用于开发在 Web 浏览器上运行的客户端应用程序? - Is Node.js is used for developing client-side applications that run on the web browser? 能否保护 web 应用程序免受浏览器扩展的影响? - Can web applications be secured against browser extensions? 单页面应用程序概念可用于创建独立桌面应用程序吗? - can single page application concepts be used for creating standalone desktop applications? Web应用程序无法在iPad上运行,但可以在桌面浏览器上运行 - Web app not working on IPad but works on desktop browser Web应用程序无法在iPad上运行,但可以在桌面浏览器上运行 - Web app not working on IPad but works on desktop browser 如何从浏览器运行桌面应用程序? - How to run desktop app from browser?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM