I am trying to verify cookie exists to block pop-up from showing. I have tried 10 different pieces of code and all fail. I think the problem resides in waht I am using for c_name. Latest attempt below. I have tried the cookie name and the domain name. Neither work.

function checkForJALACookie(c_name){
	var cookieFound = Cookies.get(c_name);
//    alert("cookiefound = " + cookieFound);  <-undefined
    if (cookieFound) {
	  alert("Cookie Found");
    else {
        alert("Cookie Not Found");

The storage inspector shows cookie name CGISESSID. I set the cookie in my code

What am I missing here?

Thanks for any insight.

…so… what are you using for cname?

c_name = ‘CGISESSID’

Only debugger message

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

CORS Enabled makes no difference


Have screen shot of cookie data but don’t see where to attach


copy/paste or drag drop into the post box and it’ll handle the posting of the screenshot.

Where are you invoking this function? What are you passing as c_name?

This is a testing block

<script type="text/javascript">

     var name = "CGISESSID";
     alert("calling check cookie then resize from ready");
//	 var c = $.cookie('CGISESSID');
//	 alert(" C = " + c);

//     if (!checkCookie()){
//       	 resizeEvent();
// 	 }


function checkForJALACookie(c_name){
	var cookieFound = Cookies.get(c_name);
   alert("cookiefound = " + cookieFound);
    if (cookieFound) {
	  alert("Cookie Found");
      console.log("Cookie found. No action necessary");
    else {
      alert("Cookie Not Found");
      console.log("No cookie found.");

My reply did not post the code???


Hi thanks for heads up.
I am more familiar with the Monks method


code here


1 Like

The domain on that cookie looks… wrong. It’s got a leading . Are you sure it’s being SENT?


If that site is live I think you should remove the alerts and use only console.log.

For a non-techy visitor a bunch of alerts would likely put them off. And a non-techy visitor is not likely to look at their dev tools and see the log messages.

The alerts are just there to test live.

Interesting:} If I go to it gets nothing for value.

If If I go to I get a return value


So your problem is the cookie domain setting.

You mean the .www as opposed to www?

I have no control over that: perl

my $domain = $ENV{'HTTP_HOST'};

sub SetUserSessionCookie
    my $printresult = "";
    my ($sname,$sid) = @_;
    my $sessioncookie = new CGI::Cookie(-name=>$sname,-value=>$sid,-  expires=>$session_cookie_timeout,-path=>'/',-domain=>$domain,-secure=>0);
    $printresult = print header(-Cookie=>[$sessioncookie],-type=>"text/html");
    warn("printresult: '$printresult'");

Working now test here

Well not quite. If I am logged in and put just in the address bar, it does not see the cookie!!

Interesting: Storage inspector show cookie for and cookie for jala-mi,org.

www.jala-cookie has data the jala- cookie has no data.

??? Lost

Took out c_name in get and works on all now, Good grief.

T*hanks all for support and steering in correct direction.


Got up this am and fail. Put c_name back in and prepend www to url if not included using .htaccess.

Seems to work. Holding breath

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.