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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-remote-injection-patch

v0.6.1

Published

Injects Cordova into a remote site.

Downloads

11

Readme

This plugin is a fork in response to the UIWebView API Deprecation.

ITMS-90809: Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs. See https://developer.apple.com/documentation/uikit/uiwebview for more information.


The remote injection plugin allows a remote site to interact with cordova's javascript APIs when loaded within your cordova app. When compared with a cordova app that packages its HTML the downside to loading a remote site is if the network is down your app is down. This can be an acceptable trade off if your site has a heavy dependency on web services. The advantage to this approach is the build, deployment, and previous investment of an existing site doesn't need to change and can continue to work for browser based users providing a smooth transition to an app which provides tighter native integration.

Features

  • Injects cordova and installed plugin JS into the webview for any remotely browsed page allowing them the same access to the cordova object and its plugins as a packaged cordova app.
  • After a developer defined interval will prompt the user if the loading of the main site is taking too long. The user's options are to wait or retry. If the user waits the prompt will be displayed again after the developer defined interval. If the site loads while the dialog is displayed the dialog is dismissed.
  • Support for iOS (WKWebView Only) and Android platforms.

Installation

cordova plugin add cordova-plugin-remote-injection

Configuration

Configuration is done via preferences in your config.xml.

CRIInjectFirstFiles

<preference name="CRIInjectFirstFiles" value="www/js/init.js" />

List of paths to JS files within the project to inject before injecting cordova into the remote site. To inject multiple separate the files with a ",".

CRIPageLoadPromptInterval

<preference name="CRIPageLoadPromptInterval" value="5" />

If the site hasn't loaded after this interval the user will be provided a choice to continue waiting or to retry loading the site. This is turned on by default. If not wanting the prompt the user set the value to 0.

CRIShowConnectionErrorDialog

<preference name="CRIShowConnectionErrorDialog" value="0" />

iOS only

By default the iOS app will display a dialog if there is a failure to connect to the site. This creates issues if wanting to use Cordova's ErrorUrl config to handle connection errors. "0" will turn off displaying of the dialog and allow the ErrorUrl config to kick in.

FAQ

1. Will Apple approve the app if it just wraps a site? Point 2.12 in their guidelines states:

2.12 Apps that are not very useful, unique, are simply web sites bundled as Apps, or do not provide any lasting entertainment value may be rejected

I make no promises for your app but our app was approved by Apple and is in the App Store. We feel we enhanced our site with the app and are not simply bundling it. We display the website but also provide notifications to our users for important events, badge count updates for alerts, etc. Our app is also specifically for the customers of our company and not general use so that may have been a factor in their decision although all we can do is speculate.

2. Will the plugin work with CSP?

Content Security Policy (CSP) is a cool thing. For the plugin to work you'll need to allow javascript to be executed and javascript data URIs.

The default policy generated by the cordova CLI will work with this plugin. At the point in time this was written the policy was:

<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">

The key to making the plugin work on Android is to ensure that you allow data URIs to be executed in the origin of which the page is served.

The most restrictive way to specify this is:

script-src 'self' data:;

For more on the topic see issue #6.

Support

Log issues on github and we'll get in contact.