npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

cordova-plugin-native-fallback

v0.2.2

Published

A Cordova plugin that provides a native fallback for network errors.

Readme

Cordova Native Fallback Plugin

A Cordova plugin that provides a native UI fallback when your application fails to load its web content due to a network error.

This plugin automatically detects when the Cordova WebView cannot reach a remote URL and displays a native alert dialog, prompting the user to retry the connection. This prevents users from seeing a blank or broken page and provides a much cleaner user experience.

Supported Platforms

  • Android
  • iOS

Installation

You can add this plugin to your Cordova project from NPM (once published) or directly from a Git repository.

# Install from NPM (replace with your actual plugin name if different)
cordova plugin add cordova-plugin-native-fallback

# Or, install directly from a Git repository
cordova plugin add <your-git-repository-url>

How It Works

The plugin works automatically out of the box. Once installed, it hooks into the native WebView's lifecycle on both Android and iOS.

  1. It listens for page loading errors, such as when the device is offline or a server is unreachable.
  2. When an error is detected, it suppresses the default web error page (e.g., "Webpage not available").
  3. Instead, it displays a native alert dialog with a "Network Error" message and a "Retry" button.
  4. If the user taps "Retry", the plugin attempts to reload the original URL that your app was trying to access.

Usage

This plugin is designed to be zero-configuration. Simply install it, and it will handle network errors automatically.

Manual Trigger (Optional)

For advanced scenarios where your application has its own logic for detecting content loading failures, you can manually trigger the native error dialog from your JavaScript code.

cordova.plugins.nativeFallback.triggerErrorFallback(
  function() { console.log("Fallback success"); },
  function() { console.log("Fallback error"); }
);

Configuration

To ensure the plugin works correctly, you may need to configure the retry URL. By default, it points to a placeholder.

To customize this, you will need to edit the source files directly:

  • Android: src/android/NativeFallback.java
  • iOS: src/ios/NativeFallback.m

In both files, find the line containing https://your.remote.url and replace it with your application's primary entry point URL.