Help - Search - Members - Calendar
Full Version: Cookie Alzheimer?
Movable Type Community Forum > Additional Resources > Tips and Tricks
Foo Fighter
In the comments posting field, "Remember personal info" does not work. You keep having to retype your info each time you post. This is not a new problem, I've had this ever since I first setup my blog.

I'm assuming this is a cookie issue. What do I have misconfigured?
Lummox JR
There seems to be a lament about this problem here. Looks like my assumption that the cookie path is to blame was right, but I can offer no other useful insights.

Lummox JR
fooljay
How about a link to your blog? Then we could see if there is a problem.
Foo Fighter
My blog

The problem doesn't always show itself. It works fine for me, but ever so often I get an e-mail from one of my visitors telling me it does not work. Perhaps the problem is on their end?
Lummox JR
If this is happening for some of your readers and not others, then I wonder if this isn't a browser issue. What browser are you using, and what browsers are used by the people who've reported this?

If it's browser-related, then the first culprit to finger is JavaScript.

Lummox JR
fooljay
Nah, I see why.

This is in your <script>:

CODE
var HOST = 'www.pocketfactory.com';


That means anyone who goes to www.pocketfactory.com will have cookie work perfectly. But anyone who goes to pocketfactory.com will NOT. Also, anyone who got a cookie using www.pocketfactory.com will not have it accessible to them if they go to pocketfactory.com.

This is why it only sometimes fails.

You can do a few things.

1) Redirect ALL requests from pocketfactory.com/* to www.pocketfactory.com/*. This is the best solution for many reasons, but many people have a bit of trouble figuring out the apache config file or .htaccess file.

2) change var HOST to 'pocketfactory.com'.

Also, you should probably set your cookie at the root of your website like so:

CODE
function rememberMe (f) {
   var now = new Date();
   fixDate(now);
   now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
   setCookie('mtcmtauth', f.author.value, now, '/', HOST, '');
   setCookie('mtcmtmail', f.email.value, now, '/', HOST, '');
   setCookie('mtcmthome', f.url.value, now, '/', HOST, '');
}

function forgetMe (f) {
   deleteCookie('mtcmtmail', '/', HOST);
   deleteCookie('mtcmthome', '/', HOST);
   deleteCookie('mtcmtauth', '/', HOST);
   f.email.value = '';
   f.author.value = '';
   f.url.value = '';
}


That way, no matter WHAT directory the page with the comment form is, your user will have access to the cookie.
Foo Fighter
The Var host in the indivual entry archive is set to:

CODE
var HOST = '<$MTBlogHost$>';


How do I get it to point to
www.pocketfactory.com/* instead?
fooljay
1) Delete line.
2) Replace with this:
CODE
var HOST = 'pocketfactory.com';

3) Smack forehead

:-)
Foo Fighter
Oh, sorry. I thought it had to be an MT tag.
fooljay
Oh, if you were talking about my option number one, it has nothing to do with var HOST or any javascript.

What I meant is, if someone goes to http://pocketfactory.com/blah/blah3/index.html (or ANYTHING which is commonly abbreviated as *) you use .htaccess or Apache mod_rewrite to direct them to http://www.pocketfactory.com/blah/blah3/index.html. That way, there is never any confusion with cookies...
fooljay
QUOTE (Foo Fighter @ Jul 28 2003, 04:07 PM)
Oh, sorry. I thought it had to be an MT tag.

Nope. Javascript knows nothing about Movable Type. If you just look at the source of the MT-output page, you see what var HOST becomes...
Kinayda
I'm having the same problem. My var looks OK. The thing is I'm running a cookie catcher to see if the page is even trying write a cookie, and it's not. Any ideas?

the page is http://kinskouch.virtualsushi.us/

UPDATE: Fixed!
Info found here
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.