Skip to main content
Known Participant
September 14, 2010
Question

Session variables not clearing

  • September 14, 2010
  • 2 replies
  • 1299 views

Hello,

I'm working on a series of web pages that will be compatible with an Apple iPad.  Here's what I'm working on:

When a user hits my index.cfm page, CF checks a table for records.  If there are no records, cflocation sends the user to a menu page and only creates one session variable, "Device."

If there is one record in the table, cf creates the variables "Device" and "Loc" and sets "Loc" to whatever the value in a certain table field is.  Then cflocation sends the user to the same menu page as above, but because "Loc" is defined, the value of "Loc" is output in various places on the page.

If more than one record is found, the user must select their choice from the index.cfm page.  From there, cflocation takes their choice, adds it to a url variable, and takes the user to a page that defines "Loc" based on the url variable.  Then cflocation sends the user to the same menu page, but because "Loc" is defined, the value of "Loc" is output in various places on the page.

Everything works well.

Here's the problem: I can't get "Loc" to clear on demand.  At the top of my index page, I have <cfscript>StructDelete(Session, "Loc");</cfscript> to clear anything that might be in the application.  On my desktop (a PC browsing with Chrome), this works.  For testing, I'll put one record in the table and the process that I described above works. If I delete that record and run index.cfm again, "Loc" is cleared and the menu page appears as it should.

However, if I add a record, run index.cfm on my iPad to create "Loc," then go back and delete the record from the table and run index.cfm again, the variable is still defined.  This happens on the iPad only.

I'm stuck. Can anyone offer any insight?

Thank you!

    This topic has been closed for replies.

    2 replies

    Inspiring
    September 15, 2010

    Is it possible that the iPad's browser is caching the HTML your CF generates more aggressively than your PC?  Have you verified that index.cfm is not being cached by the iPad?

    Edit: I just realized a previous posted had already made this suggestion, sorry for the repetition.

    Message was edited by: JR "Bob" Dobbs

    straffenpAuthor
    Known Participant
    September 15, 2010

    Thanks to both of you for your responses.  I tried clearing the cache and the cookies and that worked, but only once.  I think the iPad is caching the pages differently than the PC. Is there a workaround for caching pages? Is there a piece of cf code that will tell the browser not to cache? Any other ideas before I go back to the drawing board? Thanks again.

    Inspiring
    September 15, 2010

    Are you telling the page to not cache?

    http://www.w3schools.com/wap/tag_meta.asp

    --

    Adam

    ilssac
    Inspiring
    September 14, 2010

    straffenp wrote:

    I'm stuck. Can anyone offer any insight?

    Insight One:  Do some network sniffing to confirm that the IPad is requesting and receiving a new copy of the page.  Not doing some type of caching trick where it might be going "Hey web server is this page different then the last time I go it?  No.  Ok, thank you, I'll just redisplay the old one and save bandwidth."

    Insight Two:  Follow your program logic extremely carefully and make sure that for some reason the IPad is presenting data that is triggering the Loc variable to automatically be regenerated.