Code Monkey home page Code Monkey logo

cordova-cookie-emperor's Introduction

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

cordova-cookie-emperor's People

Contributors

dougnukem avatar jligeza avatar kristianhristov avatar rtk avatar sshh12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cordova-cookie-emperor's Issues

Can't install in MacOS 11

I can't install the plugin using command line nor cordova build
It's weird because a few moments before, I was able to install it on a ubuntu laptop, build and test for the same App on a Android platform

I tried to remove "ios" directory, rebuild from scratch but same error

Here is the message log :

Discovered plugin "cordova-plugin-androidx-adapter". Adding it to the project
Installing "cordova-plugin-androidx-adapter" for ios
Adding cordova-plugin-androidx-adapter to package.json
Discovered plugin "cordova-plugin-cookieemperor". Adding it to the project
Failed to fetch plugin git+https://github.com/RTK/cordova-cookie-emperor.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: CordovaError: Could not determine package name from output:
up to date, audited 1689 packages in 13s

9 low severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
[ERROR] An error occurred while running subprocess cordova.
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:140:43
    at processTicksAndRejections (node:internal/process/task_queues:93:5)

here"s the line in package.json
"cordova-plugin-cookieemperor": "git+https://github.com/RTK/cordova-cookie-emperor.git",

I don't know which other info could be useful

Can't install it using [email protected]

I tried install it in my project following README instructions but I'm stuck on this

> cordova plugin add https://github.com/rtk/cordova-cookie-emperor.git --save
Failed to fetch plugin https://github.com/rtk/cordova-cookie-emperor.git via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type undefined
[ERROR] An error occurred while running subprocess cordova.

Searching for any leads that could help me I've found this;

https://ourcodeworld.com/articles/read/455/cordova-error-failed-to-fetch-plugin-npm-not-being-able-to-find-a-package-json-in-a-package-you-are-trying-to-install

you will need to create a new package.json file in the root folder of your plugin.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.