Jump to content

Jquery Mobile - Lost $Session After Refresh


Recommended Posts

Hi guys, 

I have a jquery mobile $session problem : 

Some background :
The system itself is a mix between CodeIgniter and PW - customer login, business logic calculations are done via CI; however some static pages are displayed via PW. CI sets $_SESSIONS on login, which are then used from processwire; furthermore PW API is used by CI to create new pages, add text images, etc. 
All of the above works fine on a desktop/tablet

The problem :

That's where jQuery mobile comes. To detect mobile devices I've used this logic inside site/config.php

if( check_user_agent('mobile') ) {
    $config->urls->templates = '/site-mobile/templates/';
    $config->paths->templates = $rootPath . $config->urls->templates;

It all works good - I get redirected accordingly; 

Sadly there is a but - On the mobile version after I (user) manually refresh the page or open another page the $session goes from this

array(6) {
  array(0) {
  string(19) "my_email@gmail.com"
  string(5) "Boris"
  string(7) "Processwire"

to nothing:

array(1) {
  array(0) {

The original idea was for the mobile to sit on m.mysite.com ,but for cross domain requests, session and seo issues this is not an option. 

What have I tried with jQuery Mobile so far : 

  • disable ajax globally / page specifically 
  • force full urls e.g. from /page to www.mysite.com/page
  • 'a' tags data-ajax=false
  • pass sessions from $_SESSION to PW $session->varname - it goes empty on refresh

As mentioned it all works fine on the desktop version, so I'm pretty sure that has something to do with jQuery mobile. 
Any ideas. suggestions, notes, topics or anything on the subject is highly appreciated!

Please let me know if you want me to display more code samples. 

Link to comment
Share on other sites

Pw creates new session on login. Please see if your session_id changes. Hard to believe that jQuery mobile has role here (that's of course possible too), I would debug the login part and/or shared sessions between pw and codeigniter.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...