Welcome Guest, Not a member yet? Register   Sign In
set_cookie works in Firefox, but fails in Chrome and IE

This is very weird. I've done a welcome page, so that when a new user enters the web, he/she is displayed a welcome screen and a language selector. Then the selection is sent via POST, a cookie is set and there is a redirect to the same page, and since the cookie has been created already, the user enters the homepage.

Everything works perfectly in FF, but for some reason the cookie is not being created in Chrome and IE. Cookies are enabled because the ci_session and csrf cookies are being created. What might be happening??

This is part of the code:

$cookie_lang = $this->input->cookie('myweb_language');
        if (!$cookie_lang) {
            // Still no cookie. Check whether language selection is sent
            $lang_sel = $this->input->post('lang_sel');
            if (!empty($lang_sel)) {
            else {
                // No cookie nor language selection. Display welcome screen.

The function _create_lang_cookie:

private function _create_lang_cookie($lang_sel) {
        $cookie = array(
                    'name'   => 'language',
                    'value'  => $lang_sel,
                    'expire' => 604800,
                    'domain' => get_domain(), // retrieves current domain name
                    'path'   => '/',
                    'prefix' => 'myweb_',
                    'secure' => false
        redirect(base_url() . ($lang_sel == 'es' ? '' : $lang_sel . '/'));

Theme © iAndrew 2016 - Forum software by © MyBB