troubleshooting Question

Session Cookies

Avatar of ChrisTERiS
ChrisTERiS asked on
JavaScript
2 Comments1 Solution288 ViewsLast Modified:
I've the follow javascript function which store some criteria from my search form to cookies.
function saveParametersWithFilter(){
Set_Cookie( "category_filter", DG_gvv('category_filter'), 1);
Set_Cookie( "user_filter", DG_gvv('user_filter'), 1);
Set_Cookie( "location_filter", DG_gvv('location_filter'), 1);
Set_Cookie( "adtype_filter", DG_gvv('adtype_filter'), 1);
Set_Cookie( "title_filter", DG_gvv('title_filter'), 1);
Set_Cookie( "seller_filter", DG_gvv('seller_filter'), 1);
Set_Cookie( "status_filter", DG_gvv('status_filter'), 1);
Set_Cookie( "min_price_filter", DG_gvv('min_price_filter'), 1);
Set_Cookie( "max_price_filter", DG_gvv('max_price_filter'), 1);
Set_Cookie( "date_filter", DG_gvv('date_filter'), 1);
DG_saveParameters();
}

The problem is that this function store the data for ever. I tried many different ways to set the cookie life but I had no luck. Finally I used another function to erase the cookies:
function DG_resetSearch() {
eraseCookie("DG_parametersclassifieds_search");
eraseCookie("category_filter");	
eraseCookie("user_filter");
eraseCookie("location_filter");
eraseCookie("adtype_filter");
eraseCookie("title_filter");
eraseCookie("seller_filter");
eraseCookie("status_filter");
eraseCookie("min_price_filter");
eraseCookie("max_price_filter");
eraseCookie("date_filter");
DG_hss("rstsearch" + ac(),"none");
DG_closeSearch();
DG_Do ("resetsearch");
}
But I found difficulties to use it body onunload. Works with FF not with IE. Same (bad) luck I had using onbeforeunload.
I've hear that there are session only cookies in Javascript. I mean Cookies staying alive till the user will close the browser (but not moving from page to page).

So my questions are:
1.- Can someone tell me how I can modify these functions to work as session cookies?
....or....
2.- What I'm trying to do is to keep the search criteria active when someone clicks (eg a title from the list), goes to the record view page and then clicks the browser's back button. Only in this case I want to have the cookies active. In all other cases I want the cookies to be erased.
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros