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

  • SEARCH
  • Home
  • 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 8357337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:26:43+00:00 2026-06-09T10:26:43+00:00

I am using this code to open an html pop up, to which is

  • 0

I am using this code to open an html pop up, to which is wish to add a “don’t show again” button that will store a preference in a cookie so that the pop up won’t be shown again
Why isn’t it working?

this is the line that should write the cookie:

document.cookie = "dontShow=1; path=/; expires=Wednesday, 01-Jan-2020 12:00:00 GMT; domain=.qpcftw.co.cc";

Update: the problem is that the cookie isn’t stored, and the “alert(document.cookie);” (see below) shows that the cookie is null (nothing is shown).

Here’s the full JS code:

/***************************/
//@Author: Adrian "yEnS" Mato Gondelle
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!
/***************************/
var popupStatus = 0;

$(document).ready(function(){
        if (document.cookie != "dontShow=1; path=/; expires=Wednesday, 01-Jan-2040 12:00:00 GMT; domain=.qpcftw.co.cc"){
        $("#backgroundPopup").css({
            "opacity": "0.75"
        });
        $("#backgroundPopup").fadeIn(1000);
        $("#popupContact").fadeIn(1000);
        popupStatus = 1;
        }
    //CLOSING POPUP
        //Don't show again
        $("#dontShow").click(function(){
            document.cookie = "dontShow=1; path=/; expires=Wednesday, 01-Jan-2020 12:00:00 GMT; domain=.qpcftw.co.cc";
            alert(document.cookie); //4debugging
            disablePopup();
        });
        //Click the x event!
        $("#popupContactClose").click(function(){
            disablePopup();
        });
        //Click out event!
        $("#backgroundPopup").click(function(){
            disablePopup();
        });
        //Press Escape event!
        $(document).keypress(function(e){
            if(e.keyCode==27 && popupStatus==1){
                disablePopup();
            }
        });
});

//disabling popup with jQuery magic!
function disablePopup(){
    //disables popup only if it is enabled
    if(popupStatus==1){
        $("#backgroundPopup").fadeOut(500);
        $("#popupContact").fadeOut(500);
        popupStatus = 0;
    }
}
  • 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-09T10:26:44+00:00Added an answer on June 9, 2026 at 10:26 am

    Try this:

    Fiddle Demo

    document.cookie = 'dontShow=1; expires=Wed, 01 Jan 2020 12:00:00 GMT; path=/';
    
    function readCookie(option) {
        var optionEQ = option + '=';
        var ca = document.cookie.split(';');
    
        for(var i = 0; i < ca.length; i++) {
            var c = ca[i];
    
            while(c.charAt(0) === ' ') {
                c = c.substring(1, c.length);
            }
    
            if (c.indexOf(optionEQ) === 0) {
                return c.substring(optionEQ.length, c.length);
            }
        }
    
        return false;
    }
    
    if (!readCookie('dontShow')) {
        //run your popup code
    }
    

    Edit: Or, as a custom jQuery plugin:

    Plugin version Fiddle

    document.cookie = 'dontShow=1; expires=Wed, 01 Jan 2020 12:00:00 GMT; path=/';
    
    (function($) {
        $.fn.readCookie = function(option) {
            var optionEQ = option + '=';
            var ca = document.cookie.split(';');
    
            for(var i = 0; i < ca.length; i++) {
                var c = ca[i];
    
                while(c.charAt(0) === ' ') {
                    c = c.substring(1, c.length);
                }
    
                if (c.indexOf(optionEQ) === 0) {
                    return c.substring(optionEQ.length, c.length);
                }
            }
    
            return false;
        }
    })(jQuery);
    
    if (!$(document).readCookie('dontShow')) {
        $('#cookie-status').html('<p>Cookie not set.</p>');
    } else {
        $('#cookie-status').html('<p>Cookie has been set.</p>');
    }
    

    Hope this helps! 🙂

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

Sidebar

Related Questions

When I open a file using this code if (ofd.ShowDialog() == DialogResult.OK) text =
currently i using this code in phonegap application var xmlhttp = new XMLHttpRequest(); xmlhttp.open(GET,http://192.168.1.19:8080/searchMobile?categoryRequest=true,
Having this code: using (BinaryWriter writer = new BinaryWriter(File.Open(ProjectPath, FileMode.Create))) { //save something here
I am using C to open a file for reading. I have this code
Using this code var html='<div class=somediv></div>'; var target=document.getElementById('contentArea'); target.appendChild(html); I'm getting Uncaught Error: NOT_FOUND_ERR:
i am using this code for upload files to a server(in html): <form action=
I'm using this very common line of code to create a HTML 5 local
I am fetching Google in a gadget using this code: <html> <head> <title>Browser</title> </head>
I've got the following code that I'm using to get a html page. Make
Using this code, i am able to send a notification to my own device.

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.