How do I determine if a user has cookies turned off? Some of our users in the corporate environment have cookies turned off and are complaining that they can't log in. I'd like to display a message if this is the case. How do I do this? Thanks for your help.
on 2007-05-09 15:04
on 2007-05-09 16:27
Hi, > How do I determine if a user has cookies turned off? Some of our users > in the corporate environment have cookies turned off and are complaining > that they can't log in. I'd like to display a message if this is the > case. How do I do this? I've implemented something like this with a before_filter in my application controller. Rails send a session cookie to the client after the first user request. Check your application_controller.rb what it's called. Most times it's called something like "_projectname_session_id" with projectname replaced with the name of your application. class ApplicationController < ActionController::Base session :session_key => '_projectname_session_id' ... before_filter :check_if_cookies_work ... protected def check_if_cookies_work flash[:alert] = "Please enable cookies!" if cookies[:_projectname_session_id].nil? end ... end Hope this helps. Regards, Timo
on 2007-05-12 09:27
You can also check session.new_session in the login action. If cookies are turned off, this will be true all the time since rails will attempt to set it on every request. On May 9, 10:26 pm, Timo Springmann <t.springm...@linet-services.de>