State cookie problem.

State cookie problem.

andrew_mandrew_m Posts: 31Questions: 0Answers: 0
edited March 2009 in General
Hi Allan.

We are using bStateSave mode to save grids state and we faced one issue: at some point we found that datatables creates 2 cookies for state saving: "SpryMedia_DataTables_backlog_Backlog" and "SpryMedia_DataTables_backlog_backlog". Note the difference - last part "backlog" differs in first letter position. We dived into datatables code and found this string: sName += '_'+window.location.pathname.replace(/[\/:]/g,""); in _fnCreateCookie function. It appends path to cookie, but seems without paths case taking into account. So if we request Url /Backlog cookie with name ..._Backlog will be created. If we request /backlog, cookie with name ..._backlog will be created, but in both cases server returns same page.

So here is the problem - there may be 2 cookies created for single grid on physically same page. And in one case datatables will load one state, in other case - other state.

Maybe converting cookie path to lower case resolves this problem?


  • allanallan Posts: 60,962Questions: 1Answers: 9,939 Site admin
    Hi Andrew,

    I see what you mean - however, part of the problem in dealing with this is the HTTP allows that part of the URI to be case sensitive. Having said that, I would imagine that there are very few pages which rely on this, as as such I would tend to agree that from an ease of use point of view, the path should be done in lower case. I'll make this change in the next beta.

    It should be that the path name is actually in the cookie (path:) but IE appears to have a bug when it is the non-root path... This was the only way I could see around it.

  • andrew_mandrew_m Posts: 31Questions: 0Answers: 0
    Thanks Allan.
This discussion has been closed.