in reply to Re: Re: What's the path when setting cookie via an exec cgi include?
in thread What's the path when setting cookie via an exec cgi include?
A workaround is to set the cookie with javascript. Javascript will allow you to set a cookie after the content header has already been sent (as in your case). So /cgi-bin/myscript.cgi could print the javascript html code setting the cookie/s you need.
Although this isn't perl, here's some javascript for setting a cookie. It's a function followed by the call. This script sets a cookie called myName to Bubba. You set the cookie just like you would in perl. Specifying all the cookie parameters you need. Again, this snippet is javascript, not perl.
jtruefunction setCookie(name, value, expires, path, domain, secure) { var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : ""); document.cookie = curCookie; } now=new Date(); now.setFullYear(now.getFullYear()+1); setCookie("myName", "Bubba", now, "/" ,".yourdomain.com");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re[4]: What's the path when setting cookie via an exec cgi include?
by Tanalis (Curate) on May 15, 2003 at 08:05 UTC | |
by Cody Pendant (Prior) on May 15, 2003 at 23:32 UTC |