JS Days 2025 is now live – Join 5,000+ devs for the premier virtual JavaScript event. Register Now

Create Web Apps with the Capabilities of Native Apps

January 5, 2017 1825 Views
Show

Create Web Apps with the Capabilities of Native Apps

One of the biggest challenges for web apps has been that they didn’t look and feel like native apps. Web apps have historically had poor offline capabilities, performance limitations, and almost no access to internal or external hardware. These limitations have motivated many HTML5 developers to use technologies like Cordova and Electron to create hybrid apps that behave like native apps – bridging the technology gap between native and web technologies. Soon, this will no longer be a concern.

Modern web browsers provide new capabilities, so developers can create native-like web apps. Chrome and Firefox already allow web apps to launch from the home screen, run offline, access internal hardware, and even run code compiled in C++ at blazing speed. Last month, I gave a talk at SenchaCon on some of latest technologies that make these new capabilities for web apps possible.

In this article, I will highlight some of these game-changing technologies that will allow you to create a new class of high-performance web apps with native-like capabilities.

Offline Access and Launching from Home Screen

Offline Access

Although the Application Cache API has been available since Internet Explorer 10, it’s been crippled with several annoying limitations. The new Cache API along with Service Workers have fixed many of these limitations. Unfortunately, the implementation of Service Workers and the new Cache API are proving too complicated for many developers. In order to significantly simplify implementation, Ext JS apps can now implement caching with a single line of code using an annotation @sw-cache. Read the docs for implementation details. In addition to caching, Ext JS apps can now implement Web App Manifest features in the app.json file. Some of the capabilities enabled by Web App Manifest include home screen icons, a splash screen, and an orientation lock.

Web Push and Notifications APIs

Notifications API

Web Push allows a server to send data to a web app via the browser even if the browser or the app isn’t currently open. Using Web Push developers can create apps that are more engaging and update their users in a more timely manner regarding relevant content. In order to use Web Push API, you will need an active Service Worker. Upon receiving a message from the server a Service Worker, using the Notifications API, can choose to display a native-like notification to the user. Currently, Web Push is supported in Firefox, Chrome, and is under development in Microsoft Edge. Check out this sample code created by the Google Chrome team, which shows how to use the Web Push and Notifications API.

Hardware Capabilities

Accessing hardware is going to get a lot easier from within the web browser. Web apps have been able to access the camera, microphone, and GPS for some time using the Media Capture and Geolocation APIs. Google is making things interesting by implementing the Web Bluetooth and Web NFC APIs in Chrome. In fact, Web Bluetooth is already available in Google Chrome, you just need to activate it by going to chrome://flags and turn it on. Now that virtual reality technologies like Oculus, Samsung Gear, and even Google Cardboard are taking off, WebVR APIs are being implemented in Chrome and Firefox. Check out some of the WebVR demos using Firefox. Other interesting hardware-focused APIs under development include Web USB, Presentation API, and Web Speech. Take a look at the roadmap from the W3C Device and Sensors Working Group for other hardware-focused APIs under development.

Need for Speed

Performance was often cited as a limitation of web apps. The WebAssembly project aims to resolve performance limitations by allowing developers to compile their C/C++ code and run it in the browser at near native speeds. Google has stated that they are targeting runtime speeds within 20% of equivalent native apps. In addition to WebAssembly, there are many other new browser APIs that are improving performance. For example, most modern browsers now support hardware-accelerated CSS transformations and animations. Also, Web Crypto API enables hardware-accelerated cryptography functions.

Risks

Although Chrome, Firefox, and Microsoft Edge browsers are focusing on creating technologies in their browsers that will enable developers to create native-like web apps, it remains to be seen if Apple Safari is on board. Apple has not yet committed to implementing technologies like Web Application Manifest and Service Workers, which are dependencies for many modern web APIs that provide native-like capabilities. This leads some developers to claim that “Safari is the new Internet Explorer”. As a result, developers should programmatically test the existence of new capabilities before implementing them. The reason Safari has been slow to adopt new standards remains unclear; although one potential reason could be security risks. Recently, a vulnerability was found in the Battery Status API, implemented by Chrome and Firefox, which allowed websites to track a user even if the user cleared the browser cookies. Subsequently, Firefox announced that it would disable this capability.

In this article, I’ve highlighted a few APIs that allow developers to create native-like web apps. Are you excited about other APIs that will give developers new superpowers? If so, share your thoughts in the comments below.

Recommended Articles

Guide to Estimating ROI When Switching From DIY Libraries to Full Software Development Platforms Like Ext JS

Teams started with Do It Yourself, or DIY, JavaScript tools like jQuery and Bootstrap. But those fall apart as projects scale. Scattered code, user interface…

Top Frameworks Developers Are Using for Custom Software Development in 2025

We’re seeing it more every year; teams aren’t settling for plug-and-play tools anymore. In healthcare, finance, logistics, and other data-heavy industries, there’s a clear shift.…

Meet Sencha AI Coding Companion: Your AI-Powered Assistant for Faster Ext JS Development

Building modern web applications should be exciting. But too often, developers find themselves buried in documentation, endlessly Googling framework quirks, or stuck solving the same…

Ext JS 7.9 & Rapid Ext JS V1.1 Have Arrived

The Sencha team is excited to announce the latest Ext JS version 7.9 and Rapid Ext JS 1.1 release – designed to accelerate development, enhance…

Top 10 JS Grid Customization Tips for a Better UI Experience

Grids are pretty much everywhere in web apps. Working with financial sheets, product details, or users? Then you’ve probably used a JavaScript grid. It makes…

Why Ext JS Framework is the Go-To Framework for Building Scalable and Data-Intensive Web Apps

Web apps are much more advanced now. They deal with large amounts of data and need to stay fast, even with many users. If you’re…

View More

Trusted by Top Developers: Learn how to enhance your development journey — for free

Get the latest newsletter keeping thousands of developers in the loop.

Loved by developers at