渐进式Web应用程序(PWA)与Electron与浏览器扩展 [英] Progressive web app(PWA) vs Electron vs Browser extension

查看:475
本文介绍了渐进式Web应用程序(PWA)与Electron与浏览器扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题的背景是我一直在研究一种我称之为工具的工具,用户可以在其中构建可以稍后运行的模块.它最初是一个很小的网页,在过去的一年中发展为更类似于桌面应用程序的网页.但是,到目前为止,仍然只是一组html,css和js文件.

The background for this question is that I've been working on what I'd call a tool in which a user can build modules that they can later run. It started out as a small web page and has grown over the last year into something that more closely resembles a desktop application; but, at this point, is still just a set of html, css, and js files.

我考虑过使用电子之类的东西将其打包为可安装的桌面应用程序,但是我不喜欢这种方法,并认为最好坚持使用诸如渐进式Web应用程序之类的东西,因为一切都是离线完成的.

I considered using something like electron to package it as an installable desktop application, but I didn't like that approach and thought it better to stick to something like a progressive web app because everything is done off-line.

因为我想访问仅适用于Web扩展的API,所以我一直在阅读有关它们的MDN Web文档,这使我感到疑惑,并对PWA和浏览器扩展之间的差异感到困惑使用扩展页面来运行自己的页面/程序,而不是改变其他网页在浏览器中的查看和使用方式,等等?

Because I wanted to access APIs that are available only to web extensions, I've been reading a bit on MDN web docs about them and that has led me to wonder and become confused about the differences between a PWA and a browser extension that uses the extension pages to run its own pages/program, as opposed to altering how other web pages are viewed and used in the browser, etcetera?

如果希望他们的应用程序脱机工作并像台式机应用程序那样运行,那么使其成为浏览器扩展有何弊端?我发现有关PWA的信息比有关浏览器扩展的信息更多,给人的印象是不应以这种方式使用扩展.

If one wants their app to work off-line and behave like a desktop app, what is the downside to making it a browser extension? I came across more information on PWAs than on browser extensions, giving the impression that an extension shouldn't be used in this manner.

看来,它具有访问更多API的好处,它带有自己的图标安装在浏览器中,并且可以更改扩展页面的窗口,使其似乎不在浏览器内部运行.

It appears that the upside includes access to more APIs, it installs into the browser with its own icon, and the window of the extension pages can be altered such that it doesn't appear to be running inside a browser.

我是stackoverflow的新手,并注意到有时会关闭问题,因为问题被视为有争议的或寻求观点而非事实.因此,更具体地说,能否请您帮助我理解每种方法的利弊,和/或选择一种方法时应考虑的决策点?谢谢.

I'm new to stackoverflow and have noticed that questions are sometimes closed because they are viewed as debatable or seeking opinions rather than facts. So, to be more specific, could you please help me to understand the pros and cons of each, and/or the decision points that should be considered in choosing an approach? Thank you.

答复/评论

感谢您抽出宝贵时间回答我的问题.我想避免将问题扩展到包括电子,仅出于说明我已经对它进行了广泛审查而又不想开始对其进行讨论的目的,在我的问题中提到了它.我的问题仅与PWA和浏览器扩展有关.

I appreciate you taking time to respond to my question. Expanding the question to include electron is something I wanted to avoid and mentioned it in my question only for the purpose of stating I've already reviewed it extensively and don't want to start another discussion about it. My question is about PWAs and browser extensions only.

这个问题也与我的应用程序的细节没有多大关系.它可以作为PWA存在.问题是,如果某个应用程序已经可以作为PWA存在,那么使其成为浏览器扩展将是坏事",或者没有这样做的原因.与PWA相比,访问的API数量更多,并且安装到浏览器中使之成为家",似乎比PWA更好,没有更好的环境.

The question also doesn't have much to do with the particulars of my application. It can already exist as a PWA. The question is if an app can already exist as a PWA what would be 'bad' about making it a browser extension or reasons for not doing so. Access to more APIs than are available to PWAs and being installed into the browser giving it a 'home' appear to make an extension, for lack of a better term, a superior environment than that of a PWA.

在MDN网络文档中,有关浏览器扩展的描述包括独立游戏,但似乎鼓励将游戏集成到浏览体验中(无论可能是什么).我不是在开发游戏,而是想知道独立工具扩展有什么问题.

The description on MDN web docs of what a browser extension is includes stand-alone games but seems to encourage games that are integrated into the browsing experience--whatever that may be. I'm not building a game but wanted to know what would be wrong with an extension that is a stand-alone tool.

一个评论者似乎认为,尽管可以做到,但不应该这样做,因为扩展只是为了增强浏览体验.那可能是正确的看法.但是,另一方面,我有点喜欢在浏览器中放置一个图标的想法,该图标可以在没有浏览器菜单的窗口中打开我的应用程序(例如以全屏方式运行网站),并允许我访问下载API.这样可以为我的应用程序的用户带来更好的体验.

One commentor seems to feel that although it could be done, it ought not to be done because extensions were made for enhancing the browsing experience only. That may be the correct view. But, on the other hand, I sort of like the idea of having an icon inside the browser that opens my app in a window without a browser menu (like running a site full screen) and gives me access to the downloads API. That would give the users of my app a better experience.

但是,除了这不是扩展所做的事情,也不是历史上如何使用它们的事实之外,还有其他可能的原因不这样做.会违反规则,以后为失败做好准备,等等吗?还是只是为现有功能找到另一种用途.

But there may be other reasons to not do so, in addition to the fact that this is not what extensions were made to do nor how they have been used historically. Would it be violating a rule, setting myself up for failure later, etcetera? Or, is it simply finding another use for an existing functionality.

如果听起来像那样,我并不是想表现出粗鲁的态度,而只是想更好地阐明我的问题.谢谢.

I'm not trying to be rude if it sounds that way, but just wanted to better clarify my question. Thank you.

推荐答案

浏览器扩展-这些扩展本质上用于扩展和增强用户的浏览体验.想一想Adblocker.它本身没有用.但是当您访问其他站点时,有助于阻止添加.屏幕快照扩展,用于截取屏幕截图. Dark主题扩展程序,可在您访问的任何页面上翻转颜色.

Browser extension - These are essentially used to extend and enhance the users browsing experience. Think of a Adblocker. Its not useful by itself. But helps blocking adds when you visit other sites. A screenshot extension to take screenshots. A Dark theme extension to flip colors in any page you visit.

PWA- PWA应用程序将取代Chrome应用程序.可以在所有主要的台式机操作系统和移动操作系统中将PWA安装到台式机上.它可以脱机工作.它在硬件访问方面的功能取决于用户浏览器的版本..可以在在此处选中.网络应用程序的所有限制仍将保留.

PWA - PWA apps will replace chrome apps. PWA can be installed to desktop in all major desktop OS and mobile OS. It can work offline. What it can do in terms of hardware access depends on the users browser version.. same can be checked here. All limitations of a web app will still remain.

电子-它是一个包装有本机层(有点!)的Web应用程序.实际上,这也可以脱机工作.事实上,它首先脱机,因为所有HTML/CSS/JS组件都在Electron中堆积,它还可以访问API并执行PWA在功能上可以做的所有事情. Electron与PWA的主要区别在于其构建,分配和部署方式. Atom编辑器,Visual Code编辑器,Slack是使用HTML/CSS/JS构建并使用Electron打包的一些著名工具.

Electron - Its a web app wrapped with a native layer(kind of!). This can also work offline.. infact, its offline first as all HTML/CSS/JS components are pocked in Electron, it can also access APIs and do all that a PWA can do functionally. Electron will differ from PWA mainly in terms of how its build, distributed and deployed. Atom editor, Visual Code editor, Slack are some of famous tools built using HTML/CSS/JS and packed using Electron.

用户计算机上的PWA功能由用户浏览器版本确定,而Electron应用程序将与它一起打包其自己的运行时.因此,不依赖于用户计算机.那可能是您在决定选择哪一个时要考虑的关键事项.

PWA capabilities on users machine are determined by the users browser version, while Electron app will have its own run-time packed along with it. So no dependency on user machine. Thats probably the key thing you want to consider while deciding which one to choose.

您需要更具体地说明您要在应用程序中实现/完成的工作.您所提到的只是一个用户可以在其中构建以后可以运行的模块的工具".这根本没有提供任何见识.

You need to be more specific on what you are trying to achieve/do in your app. All you have mentioned is "a tool in which a user can build modules that they can later run". That doesn't give any insight at all.

这篇关于渐进式Web应用程序(PWA)与Electron与浏览器扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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