CodeIgniter Forums
Internet Explorer 7 + Ajax + Session Destroy = Broke? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Internet Explorer 7 + Ajax + Session Destroy = Broke? (/thread-18889.html)



Internet Explorer 7 + Ajax + Session Destroy = Broke? - El Forum - 05-21-2009

[eluser]Steven_W[/eluser]
I have a logout link that uses jquery to load the logout page with $.get. This works with firefox, ie8, and chrome. When I put ie8 in ie7 mode, the session isnt destroyed using $.get. However if I go to www.mysite.com/logout, the session is destroyed. Any help would be appreciated


jquery
Code:
$.get('/logout');


logout.php controller
Code:
function index()
{
   $this->load->library('session');
   $this->session->sess_destroy();
}

config
Code:
$config['sess_cookie_name']        = 'ec_session';
$config['sess_expiration']        = 7200;
$config['sess_encrypt_cookie']    = TRUE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']        = 'ci_sessions';
$config['sess_match_ip']        = FALSE;
$config['sess_match_useragent']    = FALSE;
$config['sess_time_to_update']     = 300;

$config['cookie_prefix']    = "";
$config['cookie_domain']    = "";
$config['cookie_path']        = "/";



Internet Explorer 7 + Ajax + Session Destroy = Broke? - El Forum - 05-21-2009

[eluser]Frank Berger[/eluser]
Frankly, you find me surprised that it works in all the other browsers... why don't you just do a link to http://mysite/logout or a [removed].href=http://mysite/logout ?

I imagine that you do checks via ajax if and how one needs to be logged out, in that case i would do it like this:

Code:
$.get('/checkmylogout',function (data) { //this returns json in my case

  if (data.logout) {
    location.href='http://mysite/logout';
} else {
   // whatever u wanna do in the other case
}
});

I mean.. either the session is due for termination or not.. why leave the user on a basically still valid page, just to realize on the next click 'hey you been logged out' - i hate when that happens

cheers
Frank


Internet Explorer 7 + Ajax + Session Destroy = Broke? - El Forum - 05-22-2009

[eluser]Steven_W[/eluser]
They wanted the user to be able to login and log out of their account without leaving the page, flash video is a big part of the site. Adding a redirect to the logout controller seems to have gotten it working in ie7 mode.


Internet Explorer 7 + Ajax + Session Destroy = Broke? - El Forum - 05-22-2009

[eluser]Tom Schlick[/eluser]
[quote author="Frank Berger" date="1242963426"]Frankly, you find me surprised that it works in all the other browsers... [/quote]

really? your surprised that IE is the devil and loves to throw problems at web developers that no other browser does? haha i fucking HATE IE ... DIE IE DIE!!!!