1.3.0 • Published 2 years ago

cordova-plugin-cors v1.3.0

Weekly downloads
210
License
LGPLv3
Repository
github
Last release
2 years ago

cordova-plugin-cors

Allow cross origin request (CORS) with WKWebView on iOS.

This plugin should be compatible with every plugin providing a WKWebView engine for Cordova and has been tested with cordova-plugin-wkwebview-engine and cordova-plugin-ionic-webview.

Installation

cordova plugin add cordova-plugin-cors

Usage

This plugin replaces the XMLHttpRequest object. There is no code modification required. It should work seamlessly.

It has been tested with pure Javascript code and with Angular HttpClient object.

Zone.js support is also integrated. Event listeners will be called within the zone used when calling send().

Example

var request = new XMLHttpRequest();
request.open('GET', 'https://cordova.apache.org', true);

request.onreadystatechange = function(event) {
    if (this.readyState === XMLHttpRequest.DONE) {
        if (this.status === 200) {
            console.info('Cross origin request was sent with success!', this.responseText);
        } else {
            console.error('Cross origin request failed :(', this.status, this.statusText);
        }
    }
};

request.send(null);

Limitations

Synchronous requests are not supported.

1.3.0

2 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

6 years ago