Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
Why I'm not getting all cookies through these ways?

Well, I need get all cookies from the current website in my chrome extension. I tried two ways:

using document.cookie:

   var getCookies = function(){
        var pairs = document.cookie.split(";");
    
        var adapted_cookies = [];
        var cookies = {};
        for (var i=0; i<pairs.length; i++){
          var pair = pairs[i].split("=");
          cookies[(pair[0]+'').trim()] = unescape(pair.slice(1).join('='));
        }
        
        Object.entries(cookies).forEach(([key, value]) => {
          let form_cookie = {
            name:key,
            value: value
          }
    
          adapted_cookies.push(form_cookie);
      });

and using chrome.cookies.getAll in my background.js:

chrome.cookies.getAll({}, (cookies) => {
    console.log(cookies)
})

here is my manifest:

{
    "manifest_version": 2,
    "name": "Auto Follow",
    "version": "1.0",
    "icons": {
        "720": "follow_icon.png" 
    },
    "description": "xxx",
    "background": {
        "scripts": ["background.js"]
     },
    "permissions": [
        "cookies",
        "https://www.instagram.com/"
      ],
    "content_scripts": [
        {
            "matches": ["https://www.instagram.com/"],
            "js": ["jquery.js","content.js"]
        }
    ]
}

Result: both alternatives bring cookies, but not all for some reason. The document.cookie bring me a lot of them, but not all, and the chrome.cookies.getAll() bring me only one. Someone know something that can help me?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!