Google is experimenting with a new file handling API for PWAs in the Chrome Canary build, where it will let the PWAs access files in the system after obtaining permission from the user. Under this, PWAs are made to register themselves to handle files and aim to improve the transparency of the PWAs mechanism and improve the user experience.
New API for Chrome PWAs
Progressive Web Apps (PWAs), if you aren’t heard of them, are the typical applications from web browsers that work as native apps in your system. These can give a streamlined experience of the specific service; thus, more and more web developers make a PWA version of their online service.
And with the rise in demand, Google and Microsoft are bringing more features to help them achieve their aim of providing the best experience. One such effort from Chrome is introducing a dedicated file handling API for PWAs in Chrome. In brief, it will let the PWAs handle (read) files from the system as they’re configured.
Also, it’s working on a new permission system for these PWAs. A PWA of an image editor would be permitted to access file types like JPEG, PNG, JFIF, etc., as relevant. As accessing these file types are important for it to manifest the purpose of editing, it should now be asking the user permission before doing so. This happens after introducing this new API, which will ask permission through a popup.
This is not supported by Chromium yet, thus not available for any stable versioned browsers running on it like Chrome or Edge. But, Google has set this in the Chrome Canary build to experiment, and it’s seemingly fine. To make it more transparent and safe, it said to work like;
“Each time a web app is visited, we check if it has a valid origin trial token, and, if so, we register the file handlers and store the expiry time of the token. If the token is not valid, we unregister the file handlers. On Chrome startup, we also unregister file handlers for all app’s where their origin trial token has expired.”