使用 GNOME Web “安装”独立 Web 应用
SPA 浏览器
![](/data/attachment/album/201812/06/144313ruvekekh3fv6lku3.jpg)


你是否经常使用单页 Web 应用（SPA），但失去了一些完整桌面应用的好处？ GNOME Web 浏览器，简称为 Web（又名 Epiphany）有一个非常棒的功能，它允许你“安装” 一个 Web 应用。安装完成后，Web 应用将显示在应用菜单、GNOME shell 搜索中，并且它在切换窗口时是一个单独的项目。这个简短的教程将引导你完成使用 GNOME Web “安装” Web 应用的步骤。


### 安装 GNOME Web


GNOME Web 未包含在默认的 Fedora 安装中。要安装它，请在软件中心搜索 “web”，然后安装。


![](/data/attachment/album/201812/06/144315pgdorhudijaagijg.png)


或者，在终端中使用以下命令：



```
sudo dnf install epiphany
```

### 安装为 Web 应用


接下来，启动 GNOME Web，然后去浏览要安装的 Web 应用。使用浏览器连接到应用，然后从菜单中选择“将站点安装为 Web 应用”：


![](/data/attachment/album/201812/06/144316a20evkveax6tyyto.png)


GNOME Web 接下来会出现一个用于编辑应用名称的对话框。将其保留为默认值 （URL） 或更改为更具描述性的内容：


![](/data/attachment/album/201812/06/144317dxw00zkz866dldkr.png)


最后，按下“创建”以 “安装” 你的新 Web 应用。创建 Web 应用后，关闭 GNOME Web。


### 使用新的 Web 应用


像使用任何典型的桌面应用一样启动 Web 应用。在 GNOME Shell Overview 中搜索它：


![](/data/attachment/album/201812/06/144318pfjmkaa09sh5ssas.jpg)


此外，Web 应用将在 `alt-tab` 应用切换器中显示为单独的应用：


![](/data/attachment/album/201812/06/144321vhm050i38ghitzfk.jpg)


另一个额外的功能是来自“已安装”的 Web 应用的所有 Web 通知都显示为常规 GNOME 通知。




---


via: <https://fedoramagazine.org/standalone-web-applications-gnome-web/>


作者：[Ryan Lerch](https://fedoramagazine.org/introducing-flatpak/) 选题：[lujun9972](https://github.com/lujun9972) 译者：[geekpi](https://github.com/geekpi) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
Do you regularly use a single-page web application, but miss some of the benefits of a full-fledged desktop application? The GNOME Web browser, simply named Web (aka Epiphany) has an awesome feature that allows you to ‘install’ a web application. By doing this, the web application is then presented in the applications menus, GNOME shell search, and is a separate item when switching windows. This short tutorial walks you through the steps of ‘installing’ a web application with GNOME Web.


### Install GNOME Web

GNOME Web is not included in the default Fedora install. To install, search in the Software application for ‘web’, and install.

Alternatively, use the following command in the terminal:

sudo dnf install epiphany

### Install as Web Application

Next, launch GNOME Web, and browse to the web application you wish to install. Connect to the application using the browser, and choose ‘Install site as Web Application’ from the menu:

GNOME Web next presents a dialog to edit the name of the application. Either leave it as the default (the URL) or change to something more descriptive:

Finally, press **Create **to ‘install’ your new web application. After creating the web application, close GNOME Web.

### Using the new web application

Launch the web application as you would with any typical desktop application. Search for it in the GNOME Shell Overview:

Additionally, the web application will appear as a separate application in the alt-tab application switcher:

One additional feature this adds is that all web notifications from the ‘installed’ web application are presented as regular GNOME notifications.


## Dragos

The standalone web applications run in isolated containers or share the cookies and stored site data with the browser?

## Michael Catanzaro

Well it’s not a Linux container, but cookies and website data are completely isolated, yes.

## Daniel

You get a copy of the origin’s cookies and data when you create the app, but from that point forward they’re separate.

## Drew

When I was logged into something in Web before making a Web Application, the login information did not carry over. Unfortunately the Login button leads to another page which doesn’t transfer back to the Web Application.

So for sites that require a log-in, Web can’t do it. Unless I am missing something here (see my other comment for details).

## Michael Catanzaro

There’s a preferences dialog to add extra hosts. It’s undiscoverable and there is a bug complaining that it doesn’t work, but it exists and you can try it. Just whitelist the hostname of the login page there.

## Michael Catanzaro

This used to be right until a couple years ago. We discovered that copying cookies into the web app was impossible to do safely, so stopped doing so. Problem was that we copied cookies from some Google domain (I think it was plus.google.com), which caused the website to break because it was expecting cookies from some different domain to be set as well: having just the cookies from the web app domain without the cookies from the other domain caused the website to break. There’s no way to make it safe, so nowadays no more copying.

## Steven

That’s good ti know, thanks

## Marcus

This is one of my favorite things about epiphany. I have also extended this to allow links to open up specific epiphany web apps. I wrote up a blog about it here:

https://blog.line72.net/2018/05/07/supporting-deep-links-in-linux-with-gnome-and-epiphany-web-apps/

## Daniel

Okay, that’s cool. Too bad you can’t manage something like this from within Epiphany itself. The about:applications manager could possibly be expanded to map URLs like this.

## Michael Catanzaro

There is an issue to add this feature upstream: https://gitlab.gnome.org/GNOME/epiphany/issues/277

Would be cool and shouldn’t be difficult, but it’d have to be done in C rather than bash. 😉

## Ondrej

I Cant see the option in gnome-apps-nightly Epiphany flatpak. Is it removed/reworked?

## Michael Catanzaro

It’s not supported under flatpak. And it’s not clear how this could ever work, since we don’t have access to the home directory to install desktop files there.

## urandom

AFAIK you can put desktop files to /var/lib/flatpak/exports/share or ~/.local/share/flatpak/exports/share, which are probably added to $XDG_DATA_DIRS by flatpak.

## Drew

That helps “fill in the blanks” with some applications you really need but there’s no Linux version of it and there is a web version.

Chrome kept trying to put saved shortcuts all over the place, but Web is a lot lighter so it comes up quicker. A better choice for stand-alone applications.

## Nick A

So Progressive Web Apps then? I know chrome has been pushing this new format, and I adore PWAs so much so I can’t not make all my web experiments that way, but I wonder how much modern web standards gnome web supports, I’ll have to look into it

## Michael Catanzaro

Nope, not at all, sorry. There’s zero support for app manifest. And service workers are supported only in development builds of WebKit, not releases. For PWA to happen would require a volunteer to push things forward.

## Drew

I just installed Web and was making a Web App for Google Hangouts. So I opened Web, navigated to the site and logged into my Google account. Then I made it into a Web Application.

When I opened the Web Application, I was not logged in. I guess this means information between Web and Web Applications are not shared.

I tried to log in, but the button opens up a new window for me to log in. When I made Web my default and clicked Log In button in the Web Application, it opened me up to Google Hangouts in Web … already logged in.

So the good news is that Web Applications are isolated from the Web’s stored data.

The bad news is, I don’t know how to set up Web to open Hangouts with me logged in.

Otherwise I like Web; it’s fast to load and if I can get the Web Applications working, will make life easier.

## hyakosm

To remove an installed webapp, it’s in “about:applications”. There is no link to this page in Gnome Web, why ?

## Michael Catanzaro

Nobody ever added a way to get there. See https://gitlab.gnome.org/GNOME/epiphany/issues/439

## Michael Tunnell

@Michael Catanzaro – they have known about this issue for at least 3 years now as that was when I submitted it to their bugzilla.

## Damon

I am interested will it work offline? For example if i create web application for google keep and edit notes offline will it synchronize next time when i connect to internet?

## Daniel

That is entirely up to the web app to handle (using WebWorkers and local storage). There is no difference between using Epiphany regularly and in webapp mode when it comes to these things.

## Channah Trimble

The epiphany browser has been getting a lot of improvements. Its performance seems comparable to safari and is amazingly lightweight. Extensions are still an issue but I cannot wait to see where epiphany goes

## Dr. Chuck

Thanks for the article. Is there anyway to have the web application run in the background, while still providing notifications? This would be particularly useful for a messaging website.

## Ranjandas

Looks like Epiphany (Web) does not support Proxy PACs. I am not able to browse anything when PAC is configured in GNOME NetworkManager settings.

## Andrew

Firefox’s Test Pilot program has a add-on “Side View” that opens web sites in a panel on the left side of the browser window. It’s another way of opening pages like chat sessions or notepads that don’t need a whole browser tab.

## henryf16

I usually like ICE for this (Peppermint OS guys, their Site Specific Browser solution). Very simple to use but not sure how it compares – speedwise – vs Web/Epiphany. Time to do a little testing…

Related: avoid electron apps because of all the fat so ICE was a great find for me.

## Torsten

Been trying to use it for https://outlook.office.com – but the login opens in a new browser window, and it seems that the app never registers that the login was successful.

Is there an option to make it work with the SSO from Microsoft?

## Michael Tunnell

I like Epiphany’s webapp system overall but there are still glaring problems they need to address.

You can’t remove CSDs so they are wasting a ton of space for no reason in a webapp.

I reported this bug to GNOME/Epiphany devs over 3 years ago . . . nothing.

It is way too hard to find the webapp manager for removal, you have to know the url address rather than built into the GUI.

I also reported this bug over 3 years ago . . .

## Alex

Some websites are added with a small icon, or no icon at all, sometimes.

I can’t find how to remove these apps. It’s a promising feature, but still lacks improvements in UX. I will check more of it out in my spare time and see if I can contribute somehow!

## Michael Tunnell

@Alex to manage the webapps in Epiphany, type in “about:applications” (without quotes) into your URL bar and that will take you to the webapp manager. Yes, this is bad that you have to know this to edit them.

I wrote an article on this topic, Webapps in Epiphany, for MakeUseOf a couple years ago and it is still fairly accurate so if you want to check that out. https://www.makeuseof.com/tag/epiphany-web-apps-integrate-web-desktop/

## Mik

There is a Gnome extension that puts a handy, drop down, menu – for all the installed webapps, – on the Gnome’s Top Bar but it’s awfully outdated.

I’ve tinkered, a bit, with its source code and managed to make it work from Fedora 27 all the way to the Fedora 29 release. Unfortunately, it stopped working the moment I’ve upgraded to Fedora 30 Beta Release.

## Leslie

Chrome does this kind of functionality for SPA’s already though

## Michael Tunnell

@Leslie Chrome doesn’t actually do this function. They make it seem like they do but it is different. In Chrome all of the webapp windows share the same session with the main Chrome instance so you can’t have multiple webapps of the same site. Epiphany has separate sessions per webapp making it much more useful in that sense because you can make as many as you want without session overlap.

## vancha

I tried using this with a chat application, but it keeps trying to sign in on another page, which then directs me to a new window, where i am already logged in. 🙁