2012-05-29 54 views

回答

1

您可以将session.use_only_cookies设置为“0”并将会话ID附加到代码中的URL,因此每个链接或重定向都会在URL中附加一个类似于“session_id = 4b5fe6a4019a8cd7fc4326664e9e03ae”的内容。

这种方法有很多问题,最大的问题是如果用户决定分享一个URL,可以说在Facebook中,他/她会从浏览器复制整个网址(包括会话ID)以及所有点击的人该链接将捕获用户的会话。

看看this

+0

我有一个很大的应用程序,所以追加session_id是一个大问题 –

1

您可以在您的登录页面显示需要cookie的警告,而不支持无cookie的浏览器。许多网络应用程序迫使您最近启用cookie。

// make sure cookies are enabled 
$.cookie('test_cookie', 'cookie_value', { path: '/' }); 
if ($.cookie('test_cookie') != 'cookie_value') { 
    noty({"text":"Cookies must be enabled to log in. <a href='http://support.google.com/accounts/bin/answer.py?hl=en&answer=61416' class='noty_link'>Click here to learn how to enable cookies.</a>","layout":"top","type":"error","textAlign":"center","easing":"swing","animateOpen":{"height":"toggle"},"speed":500,"closable":false, "closeOnSelfOver":false, "timeout":"", "closeOnSelfClick":false}); 
} 

这个代码段使用jquery.cookie.js(https://github.com/carhartl/jquery-cookie)& noty(http://needim.github.com/noty/)插件的插件

+0

但这不会是解决方案 –