javascript - How to set cookies in a rails 3 app -


i've added application.js doesn't create cookie. in fact breaks other javascript functions below it.

function gettimezone() {     var current_time = new date();     var offset = -(current_time.gettimezoneoffset() / 60);     cookie.set({timezone: offset}); } gettimezone(); 

what doing wrong?

cookie isn't build in javascript class , don't think it's part of prototype or jquery either. unless you've included javascript defines cookie, i'd that's problem.

cookie's bit of pain work in raw javascript i'd recommend using 1 of 2 plugins below make life easier.

for prototype: http://jason.pureconcepts.net/articles/javascript_cookie_object

for jquery: http://www.electrictoolbox.com/jquery-cookies/


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -