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-wkwebview-ionic-xhr

v2.1.1

Published

Cordova WKWebView Ionic XHR Plugin

Downloads

124

Readme

cordova-plugin-wkwebview-ionic-xhr 2.1.1

About the cordova-plugin-wkwebview-ionic-xhr

This plugin makes it possible to reap the performance benefits of using the new Ionic WKWebView in your Cordova app by resolving the following issues:

  • The default behavior of WKWebView is to raise a cross origin exception when loading files from the main bundle using the file protocol - "file://". The Oracle cordova-plugin-wkwebview-file-xhr plugin and cordova-plugin-ionic-webview plugin try to fix these issues in various ways. Unfortunately Ionic insists on installing cordova-plugin-ionic-webview and Oracle's cordova-plugin-wkwebview-file-xhr insists on installing the standard Cordova WKWebView plugin cordova-plugin-wkwebview-engine, which are mutually exclusive and cannot be run side by side. The cordova-plugin-ionic-webview plugin has many fixes necessary for Ionic Apps, but it doesn't fix the issue whereby the iOS WKWebView does not allow for cookies to be used via XHR requests. Oracle's cordova-plugin-wkwebview-file-xhr plugin does seem to fix this issue and hence this Fork attempts to bring together the best of both these worlds.

  • For more information see https://github.com/oracle/cordova-plugin-wkwebview-file-xhr and https://ionicframework.com/docs/wkwebview/

Installation

Plugin installation requires Cordova 4+ and iOS 9+. It will install the Ionic Cordova WKWebView plugin cordova-plugin-ionic-webview if not already installed. Note that the cordova-plugin-wkwebview-engine and cordova-plugin-ionic-webview cannot both be loaded at the same time.

cordova plugin add cordova-plugin-wkwebview-ionic-xhr

Supported Platforms

  • iOS

Quick Example

// read local resource
var xhr = XMLHttpRequest();
xhr.addEventListener("loadend", function(evt)
 {
   var data = this.responseText;
   document.getElementById("myregion").innerHtml = data;
 });
xhr.open("GET", "js/views/customers.html");
xhr.send();

// post to remote endpoint
var xhr = new XMLHttpRequest();
xhr.addEventListener("loadend", function(evt)
 {
   var product = this.response;
   document.getElementById("productId").value = product.id;
   document.getElementById("productName").value = product.name;
 });
xhr.open("POST", "https://myremote/endpoint/product");
xhr.responseType = "json";
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Accept", "application/json");
xhr.send(JSON.stringify({name: "Product 99"}));

Configuration

The following configuration options modify the default behavior of the plugin. The values are specified in config.xml as preferences:

Known Issues

The plugin caches cookies at the native layer between requests but it does not attempt to sync cookies between the WKWebView and the native sessions. From the JavaScript context, this means "document.cookie" won't contain any cookies returned from XHR handled at the native layer and the native iOS XHR will not see any cookies returned from remote resources fetched by the browser context, such as images.

Whilst this plugin resolves the main issues preventing the use of the Apache Cordova WKWebView plugin, there are other known issues with that plugin.

Changes

See CHANGELOG.

Contributing

This is an open source project forked from cordova-plugin-wkwebview-file-xhr maintained by Oracle Corp. Pull Requests are currently not being accepted. See CONTRIBUTING for details.

License

Copyright (c) 2017 Oracle and/or its affiliates The Universal Permissive License (UPL), Version 1.0

Amendments Copyright (c) 2017 Sortd, Inc and/or its affiliates The Universal Permissive License (UPL), Version 1.0*