Skip to main content
Inspiring
September 20, 2006
Question

Kill Session with Javascript

  • September 20, 2006
  • 2 replies
  • 1409 views
Hello,
This what I am doing now in the form Search page. When the form loads in the browser, I do the below to kill these session variables, but when a user pages backwards with the browser back button, for some reason the sessions do not get killed. Is there a way to use the onclick or submit event of javascript to Kill CF sessions?

<cfset Goldvars = "searchresults"&","&"searchresultsTotal"&","&"searchresults2"&","&"search2total">
<cfloop list="#Goldvars#" index="i" delimiters=",">
<cfif isdefined("session.#i#")>
<cfset rc = StructDelete(session,"#i#","True")>
</cfif>
</cfloop>
This topic has been closed for replies.

2 replies

Inspiring
September 22, 2006
>>The closest you could come would be to use js to refresh the page so that
your cf code runs.

No, the closest would be to use javascript's xmlhttprequest mechanism to
execute the page WITHOUT the refresh. (Some pretty basic ajax really)

"Dan Bracuk" <webforumsuser@macromedia.com> wrote in message
news:eertrf$b5s$1@forums.macromedia.com...
> The closest you could come would be to use js to refresh the page so that
your cf code runs.


Inspiring
September 20, 2006
The closest you could come would be to use js to refresh the page so that your cf code runs.