javascript - creating and setting domain of cookie in webextesnion -


i developing web extension , in background script want create cookie same name existing cookie "user" in localhost domain edit data.
able create cookie without specifying domain when try add domain(localhost) in cookie, not created.
can tell me wrong. here manifest.json , background-script(background.js)
manifest.json

{   "manifest_version": 2,   "name": "xyz",   "description": "abc",   "version": "1.0",     "browser_action": {    "default_icon": "icon.png",    "default_popup": "popup_page.html",    "default_title": "xyz"   },   "permissions": [    "activetab",    "tabs",    "cookies",    "*://localhost/*",    "<all_urls>",    "http://localhost/php_extension_new/jquery.js"    ],     "background": {    "scripts": ["background.js"]    },    "content_scripts": [    {      "matches": ["*://*.facebook.com/*"],      "js": ["jquery.js","content_script.js"]    }   ] } 

background.js

"use strict"; function getactivetab() {   return browser.tabs.query({active: true, currentwindow: true}); }  browser.tabs.onupdated.addlistener(listener); function listener(tabid,changeinfo,tabinfo){    if(tabinfo.status=="complete")   {     getactivetab().then((tabs) => {     var gettingall = browser.cookies.getall({  name: "user" });     gettingall.then(function(cookies)     {       var r=cookies[0].value;       var res=r.split("%2f");       /*(1)*/ document.cookie = "user = "+res[0]+"/"+tabs[0].url+"/;domain=localhost;";         /*(2)*/ document.cookie = "user = "+res[0]+"/"+tabs[0].url+"/";    });   } }; 

line 2 working fine , cookie created replacing line 2 line 1 cookie not created.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -