Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8975687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:56:35+00:00 2026-06-15T18:56:35+00:00

I create a small project without using the server. In that i set the

  • 0

I create a small project without using the server. In that i set the cookie for retrive the values. If I run this project in FF, Safari, IE 9 it works fine it sets the cookie and retrive the cookie but in chrome 23.0 it does not set cookie.

    <script>
       window.onbeforeunload=function(){
            document.cookie = "sample" + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
        }
        function setCookie(c_name,value,exdays)
        {
            var exdate=new Date();
            exdate.setDate(exdate.getDate() + exdays);
            var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
            document.cookie=c_name + "=" + c_value;
        }
        function getCookie(c_name)
        {
            var i,x,y,ARRcookies=document.cookie.split(";");
            for (i=0;i<ARRcookies.length;i++)
            {
                x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
                y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
                x=x.replace(/^\s+|\s+$/g,"");
                if (x==c_name)
                {
                    return unescape(y);
                }
            }
        }
        setCookie("sample","samplename",365);
        alert(getCookie("sample"));
    </script>

In FF, Safari, IE 9 it shows the cookie value “samplename” But in chrome 23.0 it shows “undefined”. If I use a server for this then chrome sets the cookie. How can I set cookie in chrome also with out using a server. Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:56:37+00:00Added an answer on June 15, 2026 at 6:56 pm

    It seems like Chrome intenionally is ignoring cookies for local files,
    it would work if you’d either use a local server like xammp
    browsing it with 127.0.0.1

    Or start chrome with the --enable-file-cookies flag from command line

    You can get further information on this SO question

    or this discussion

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there any way to create a new visual studio project without using IDE,
I just got off a small project using a WCF/REST Web Service that used
For a small project, I've to create in html/javascript (no Flash/Silverlight... it has to
I'm learning to do TDD in practice in small project. I want to create
I'm using NASM compiler to create small asm applications. I need to load my
I'd like to create a small 16px square icon that, when clicked, expands into
recently I started a small Django project that I developed on a local machine
I'm new to using SQL Server 2008 DB Project's in VS 2010. I found
I am doing a small project using JPA. I need to insert the employee
Good Afternoon, I made a small project using GWT 2.4.0, i display well locally

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.