Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: IE issues with Cookies

by shanu_040 (Sexton)
on Sep 25, 2008 at 13:14 UTC ( #713640=note: print w/replies, xml ) Need Help??


in reply to Re: IE issues with Cookies
in thread IE issues with Cookies

#########JS Code##############

var arrRecords = new Array(); var arrCookie = new Array(); var recCount = 0; var strRecord=""; function cookieVal(cookieName) { thisCookie = document.cookie.split("; ") for (i = 0; i < thisCookie.length; i++) { if (cookieName == thisCookie[i].split("=")[0]) { return thisCookie[i].split("=")[1]; } } return 0; } function loadCookie() { if(document.cookie != "") { if(cookieVal("Records") != 0) { arrRecords = cookieVal("Records").split(","); recCount = arrRecords.length; } } } function addToCookie(id) { /* * Comments needs to writen * * */ strRecord = ""; strRemove = ""; if(document.getElementById(id).checked == true) { strRecord = strRecord + document.getElementById(id).value; arrRecords[recCount] = strRecord; recCount = arrRecords.length; } else { strRemove = document.getElementById(id).value; strRecord = remove(strRecord, strRemove); arrRecords.splice(arrRecords.indexOf(strRemove), 1); recCount = arrRecords.length; } if (arrRecords.length != 0) { document.cookie = "Records="+arrRecords+";expires=;path=/"; } else { eraseCookie("Records"); } document.getElementById('myArticleCount').innerHTML = countRecords(); document.getElementById('myArticleCountTop').innerHTML = countRecords( +); } function selectAll(start, end) { var arrCheckbox = new Array(); if(cookieVal("Records") != 0) { var noOfRecords = (end - start) + 1; var k = start; for (var i = 0; i < noOfRecords ; i++) { var checkbox = document.getElementById('checkbox'+ k); checkbox.checked = true; k = k+1; arrCheckbox[i] = checkbox.value; } for(i=0;i<arrCheckbox.length; i++){ for(j=0;j<arrRecords.length;j++){ if(arrCheckbox[i]==arrRecords[j]) { arrRecords.splice(j,1); } } } arrRecords = arrRecords.concat(arrCheckbox); recCount = arrRecords.length; }else { for (var i = start; i <= end; i++) { i = i * 1; var checkbox = document.getElementById('checkbox'+ i); arrRecords[recCount] = checkbox.value; recCount = arrRecords.length; checkbox.checked = true; } } document.cookie = "Records="+arrRecords+";expires=;path=/"; document.getElementById('myArticleCount').innerHTML = countRecords +(); document.getElementById('myArticleCountTop').innerHTML = countReco +rds(); } function deSelectAll(start, end) { var arrCheckbox = new Array(); var noOfRecords = (end - start) + 1; var k = start; for (var i = 0; i < noOfRecords ; i++) { var checkbox = document.getElementById('checkbox'+ k); checkbox.checked = false; k = k+1; arrCheckbox[i] = checkbox.value; } //alert("arrCheckbox length is"+arrCheckbox.length); for(i=0;i<arrCheckbox.length; i++){ for(j=0;j<arrRecords.length;j++){ if(arrCheckbox[i]==arrRecords[j]) { //alert(arrRecords[j]); arrRecords.splice(j,1); } } } recCount = arrRecords.length; document.cookie = "Records="+arrRecords+";expires=;path=/"; document.getElementById('myArticleCount').innerHTML = countRecords +(); document.getElementById('myArticleCountTop').innerHTML = countReco +rds(); } function countRecords() { return arrRecords.length; } function selectAllMyArticlePage(start, end){ for(var i=start; i<=end; i++) { var checkbox = document.getElementById('checkbox'+ i); checkbox.checked = true; } } function deSelectAllMyArticlePage(start, end){ for(var i=start; i<=end; i++) { var checkbox = document.getElementById('checkbox'+ i); checkbox.checked = false; } }

###########Perl Code:##############
if (exists $ENV{'HTTP_COOKIE'}) { my $cookies = $ENV{'HTTP_COOKIE'}; my @cookies_record = split(';',$ENV{'HTTP_COOKIE'}); foreach (@cookies_record) { my ($k,$v) = split('=',$_); $k =~ s/ //g; if ($k eq 'Records') { $value = $v; } } } @selected_records = split(',', $value);
##############TT2 Code ############
[% SET subscription = cgi.param('first') %] [% SET subject = cgi.param('second') %] [% SET content = cgi.param('third') %] [% SET resource = cgi.param('forth') %] [% SET saved_search = cgi.param('saved_search') %] [% cookie = cgi.cookie( name = saved_search, value = resource, expires = '+1m', ); cookies.push(cookie) %]
###############Perl Code##################
my $template = $self->load_tt_template('setup_resource_final'); my $setup_resource_final; my @cookies; my $hash = { 'page_header' => $self->page_header(), 'page_title' => $self->page_title(), 'errors' => $submission_errors, 'content' => $self->content(), 'url' => url(), 'cookies' => \@cookies, 'page_footer' => $self->footer(), }; $$hash{'main_search'} = $self->show_main_search(); $$hash{'site'} = $self->current_site()->nuc_code; $$hash{'cgi'} = $cgi; $template->process('setup_resource_final', $hash, \$setup_reso +urce_final); if(@cookies) { @cookies = ('-cookie', [@cookies]); } $output = header(@cookies, '-CHARSET' => 'UTF-8'); $output .= $self->http_header(); $output .= $setup_resource_final; $output .= $self->http_footer();

Replies are listed 'Best First'.
Re^3: IE issues with Cookies
by Anonymous Monk on Sep 25, 2008 at 13:22 UTC
Re^3: IE issues with Cookies
by edoc (Chaplain) on Sep 26, 2008 at 05:57 UTC

    I think you'll find you need to set "path" in your cookie..

    [% cookie = cgi.cookie( name = saved_search, value = resource, expires = '+1m', path = '/', ); cookies.push(cookie) %]

    cheers,

    J

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://713640]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-05-20 01:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (72 votes). Check out past polls.

    Notices?