Skip to content

nim901/cordova-cookie-emperor

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cookie Emperor

Since cordova apps should not live without the Crosswalk Project anymore and the InAppBrowser-plugin does not use the XWalk webview sharing cookies is not that easy. Setting up cookies via document.cookie does not provide the expected result and thus the CookieMaster was born. Since CookieMaster is no longer maintained and cannot be build with android sdk < 23 (without gradle hacks) I came to the conclusion to fork this project and keep it maintained to a certain level.

Feel free to contribute, pull-requests will be reviewed.

Supported Platforms

  • Android
  • iOS

Installing

Install with Cordova CLI

$ cordova plugin add https://github.com/rtk/cordova-cookie-emperor.git

Usage

A global object cookieEmperor will be bound to the window object.

Get cookie value

window.cookieEmperor.getCookie('http://<some host>:<some port>', '<cookie name>', function(data) {
  console.log(data.cookieValue);
}, function(error) {
  if (error) {
    console.log('error: ' + error);
  }
});

Set cookie value

window.cookieEmperor.setCookie('http://<some host>:<some port>', '<cookie name>', '<cookie value>',
    function() {
        console.log('A cookie has been set');
    },
    function(error) {
        console.log('Error setting cookie: '+error);
    });

The cookie value should be formatted just like a regular document.cookie value.

Clear all cookies

window.cookieEmperor.clearAll(
    function() {
    console.log('Cookies have been cleared');
    },
    function() {
        console.log('Cookies could not be cleared');
    });

License

This plugin is distributed under the MIT License.

Thanks to

This plugin is forked from https://github.com/kristianhristov/cordova-cookie-master

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 54.4%
  • Objective-C 34.8%
  • JavaScript 10.8%