Setting Cookies in InAppBrowser URL


#1

Am trying to set a cookie for inappbrowser url after its opened in IONIC application using tough-cookie.But it’s not working.Can you please help me out. Below is my code:

var tough = require('tough-cookie');
var cookiejar = new tough.CookieJar();
cookiejar.setCookie("cookie-accepted=2", 
'http://currentdomain.example.com/path', function(err) {console.log("err"+err);});

No error but cookie not set

Using Cookie-Master

cordova.cookieMaster.setCookieValue('https://www.url.fr', 'cookie-agreed', 
'2',
 function() {
    console.log('A cookie has been set');
 },
function(error) {
    console.log('Error setting cookie: '+error);
});

Getting error as cookieMaster of undefined.Tried cordova.plugins.cookieMaster also.Also tried window.plugins.cookieMaster.