What browser opens a PWA when it is launched from home screen app icon - progressive-web-apps

I am examining PWA and Web Components technologies recently. As far as I have learned now Web Components is a new suit of tech,
Custom Elements, Shadow DOM, HTML Templates and HTML imports. Together with those Web Components enabling techs Web App Manifest, Service Workers, and certain performance improvement techniques used to make what is called as Progressive Web Applications.
What I wonder is when one "Adds to Home Screen" an application in a certain web browser what is the browser that opens it when it is launched from its home screen icon? Is it the browser it has been added to home screen from, or it is the default browser of the system no matter which browser it has been added to home screen from, or it is just a generic web view available on the host operating system at the moment like the one used in native web applications?
Lastly, is it possible for a developer coding her/his app to choose one?

Currently, for me, these combinations open a new "Standalone" window
I believe Android/Chrome is the only one that installs a WebApk
All the others are just shortcuts to open your website in that browser without the normal browser navigation items
I know of no options for the developer for how the shortcut opens your PWA
Android 8.10 - Chrome 67
Android 8.10 - Chrome (beta) 68
Android 8.10 - Edge 42
Android 8.10 - Opera 43
iOS 11.4 (simulator) - Safari

As test I created app shortcut of site https://pwa.rocks from browser:
Brave
Firefox
Chrome
and found that there were 3 different shortcut created for each of the browser. Launching each shortcut resulted in opening the respective browser that created it.
I believe there is no way of changing the default browser to launch the app by coding something in the app. I could not find a way of doing that, if someone knows how to do it, I will be interested to know about it
Here is similar question: What browser will PWA (Progressive Web App) use after adding to home screen?

Related

Flutter Web on iOS Safari not showing (rendering??) well

Hi I made a simple web with Flutter and I made it responsive, so I checked with chrome dev tools if all works properly and it does.
Like this picture, that is from Chrome dev tools
The thing is that when I deployed with firebase hosting, I tested it on an Iphone 8 plus with safari and the menu is not showing well, and I don't have any idea of why
As you can see the menu is cutted. Also if you know how to remove the annoying bottom white bar that is created only on mobile web I will appreciate it.

Close browser window and open PWA once PWA installed

I have Chrome installing my PWA on Android - once it's installed I'd like to automatically close the browser window it was installed from, and open the PWA (so the user doesn't continue in the browser window, thinking they're using the PWA) - is this possible?
i was looking for a similar solution and have not yet found a way to do that. I try to describe my findings so far:
CLOSING THE BROWSER WINDOW:
as described in this answer window.close() can only be called on windows/tabs that the script opened itself. Some possible workarounds are being discussed there.
OPENING THE PWA RIGHT AFTER INSTALLATION:
Google describes in their WebApk Fundamentals Article it as follows:
When a Progressive Web App is installed on Android, it will register a set of intent filters for all URLs within the scope of the app. When a user clicks on a link that is within the scope of the app, the app will be opened, rather than opening within a browser tab.
I was hoping that would work also right after the installation/Adding to homescreen from the still open browser window.
Based on testing with two Android devices it seems as if at the moment the user has to manually open the PWA from the homescreen once for chrome/android to interpret the scope of the web apps manifest.json as intend to open the page in standalone.
This is sad for even iOS seems to handle that different.
Maybe I am overlooking something in the Google Article? I also do not fully understand androids intent API - so maybe there is some way to still achieve that (?)
Based from this blog post:
When the PWA is installed, it will appear in the home screen, in the
app launcher, in Settings and as any other first-class citizen app in
the OS, including information on battery and space used in the system.
There's a tracking event when the user opens the app from the home screen. That means the user has clicked the app's icon or, on Android with WebAPK support, also clicked on a link pointing to the PWA scope and need to close the browser.
start_url: '/?utm_source=standalone&utm_medium=pwa'
Also, the following script leaves us a boolean stating if the user is currently in a browser (true) or a standalone app mode (false)
var isPWAinBrowser = true;
// replace standalone with fullscreen or minimal-ui according to your manifest
if (matchMedia('(display-mode: standalone)').matches) {
// Android and iOS 11.3+
isPWAinBrowser = false;
} else if ('standalone' in navigator) {
// useful for iOS < 11.3
isPWAinBrowser = !navigator.standalone;
}
I had this problem on Android with Chrome. The change that made the difference is adding "target='_blank'" to the link. It looks like:
window.addEventListener('appinstalled', function(event){
setTimeout(function(){
presentToUser("<a href='https://myhostname.com' target='_blank'>Go to App</a>")
}, 10000)}
});
The ten second timeout is to give Android the time to set up the App on the home page.
I had made that adjustment earlier; possibly I can remove it?
But setting the target was what made this work.
The App opens over the top of Chrome, obscuring it.
So closing the browser is not immediately required but is recommended.
In the new versions of chrome, after installation in android it associate all the links in the "scope" to the PWA application, if you try to open a link in your chrome browser it open directly in the application.
hope that will answer your question

How to install a Progressive Web App on a mobile device?

Im using an iPhone to browser thru various PWA demos online.
Is the installation as simple as adding the URL to the Home Screen?
Well, as of today, iOS lacks proper support for PWAs, so you won't get any PWA-specific benefits of adding the Web app that is a PWA to the Home Screen on your iPhone. Basically, yes, you will have a shortcut on your Home Screen, but it wouldn't give you any Service Worker capabilities and also your users will never be prompted to add the app to the Home Screen automatically.
On iOS there is only a non-standard Apple solution with meta tags available that allows you to customize the appearance of your website when added to the Home Screen to some extent. See Apple docs.
See What Web Can Do and caniuse.
UPDATE Jun 2018: As of Safari 11.3, iOS supports PWA installation and Service Worker features. However it does not prompt for installation, so the only way to "install" a PWA is to use good old "add to home screen" menu link. Also, it still does not support Service Worker-based Push messaging.

Making Chrome web app standalone desktop program

Google announced that they drop support for web apps in Chrome.
Basically, web app is a local HTML/CSS/JS app that runs in a separated custom "standalone" Chrome window.
Is there any way (preferably easy), to convert this web app to a real desktop app that not depend on Chrome in anyway? Using maybe NodeJS? If yes what is the right way to do it?
Thanks.
You could try one of these tools:
https://applicationize.me/
https://www.bzgapps.com/coherence
https://fluidapp.com/ (for Mac only)
Don't know about "easy", but it seems to me that the natural evolution is to Electron or NW.js, and both of these are mentioned in the Google blog article on this subject. (I'm moving to Electron.) Both have advantages over Chrome Apps, mostly that they are true desktop applications. To cite one example, you can now manipulate the menu bar, something out-of-bounds for Chrome Apps.
Pure JavaScript code in your Chrome App, such as anything to access the internet, should move over directly. Same for much UI stuff, as you're still using a browser window for the UI. The app will, however, have to be restructured.
Added Note: Chrome Apps ran on 4 platforms: MacOS, Windows, Linux, ChromeOS. Electron and NW.js apps won't run on ChromeOS. So, the ability to write a four-platform completely binary-portable app is going away.

Iphone4 "add to home screen" instant startup

How do you make a web app start up instantly - is it possible to make as fast as a native app that is already loaded?
I have developed a HTML5 web app that runs nicely on Iphone 4 with a splashscreen. But now I'm looking into performance:
I use a manifest file to ensure that all files are loaded from the local storage. I have checked both in chrome and mobile safari, that the files are stored correctly locally. Now performance it quite different depending on how I access my web app:
~4s When I load the web app in browser (not from a home screen icon).
~6s When I load from an "add to homescreen" icon
When I load in chrome browser it takes 234ms to load and render the whole page. I seems like the lack of speed is due to the rendering being pretty slow.
Any performance suggestions are very welcome.
I know from experience that a MacOSX device the Chrome App all of its previous versions/updates leaves in its App. This maybe also apply to ios, since it's is a stripped version of the MacOSX sysem.
It might help to delete the Chrome App from your iPhone and re-install it from the App store.
This way you be sure you have a clean copy op Chrome on the iPhone whithout all the previous Chrome versions.
I hope this helps.