Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

40,026 questions

51,982 answers

573 users

How to get cookie with JavaScript

1 Answer

0 votes
function getCookie(name) 
{
    var nm = name + "=";
    var all_cookies = document.cookie.split(';');
    for(var i = 0; i < all_cookies.length; i++) 
    {
        var c_data_items = all_cookies[i];
        while (c_data_items.charAt(0) == ' ') c_data_items = c_data_items.substring(1);
        if (c_data_items.indexOf(nm) == 0) 
            return c_data_items.substring(name.length + 1, c_data_items.length);
    }
    return "";
}

var data = getCookie('workingframe_user');
document.write(data);

/*
run:
  
avibootz
    
*/

 



answered Jul 27, 2015 by avibootz

Related questions

2 answers 232 views
232 views asked Jul 27, 2015 by avibootz
1 answer 150 views
150 views asked Jul 27, 2015 by avibootz
2 answers 210 views
210 views asked Dec 21, 2015 by avibootz
2 answers 276 views
...