CodeIgniter Forums
Redirect not working in Safari after a flash session is set - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Redirect not working in Safari after a flash session is set (/thread-49468.html)



Redirect not working in Safari after a flash session is set - El Forum - 02-20-2012

[eluser]Damien Tan[/eluser]
This is really killing me.
Apparently Safari do not process redirect after setting a flash session.

it works in Chrome though.. Anyone got a solution?

Tried the cookie domain name settings in config but it did not work!


Redirect not working in Safari after a flash session is set - El Forum - 02-20-2012

[eluser]skunkbad[/eluser]
Safari doesn't know what a flash session is. All it knows is that you set a cookie. Have you looked at the request headers? Have you tried other browsers besides Chrome and Safari? Is it Safari on Mac or Windows? What have you done to try to debug?


Redirect not working in Safari after a flash session is set - El Forum - 02-20-2012

[eluser]Damien Tan[/eluser]
I have something like this:

Code:
$this->ci->session->set_flashdata('createdOrder', True);
redirect('pages/view/order#bet', 'refresh');

The user will be redirected back to the form page once they have successfully created an order.
A message will be generated in the form page if the createdOrder is True.


It is working in Chrome and thinking that Safari is also based on webkit, they should react the same way.
However, Safari just returned a blank page. Manually redirecting however works and retain the session.

I am running local, Safari on Mac and I have yet to test it on other browsers.
Any ideas what's wrong?


Redirect not working in Safari after a flash session is set - El Forum - 02-20-2012

[eluser]skunkbad[/eluser]
As far as I know, you can't set a cookie and redirect in the same request. I may be wrong, but once redirected, if you check the cookie data, you may not find that the expected value is there.


Redirect not working in Safari after a flash session is set - El Forum - 02-20-2012

[eluser]Damien Tan[/eluser]
The cookie data is there but the redirect do not work in Safari.

Any idea how could I pass variables over to another page?
?var=value does not work because I have a #bet after the url.


Redirect not working in Safari after a flash session is set - El Forum - 02-22-2012

[eluser]Damien Tan[/eluser]
Could there be any other solution to this?
Please help!