2

I'm having an application whose session is maintained by server.The user can login and view the brands if session is active.If the session expires,the user is redirected to the login screen. On login,it will be redirected to the last page loaded and not the homepage of the application which is the requirement. It will be redirected to Home page if I clear manually the cookie from the settings menu in iPad.I need to do it programatically.

I have tried to get local cookie values using documeny.cookie but no value is there inside that.

Please help me out in clearing the cookie values and localstorage data programatically either using Javascript or jQuery functionalities.

1 Answers1

0

For deleting cookie data, look at this question. You could do it like this :

function del_cookie(cookieName)
{
  document.cookie = cookieName+ '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}

And for deleting a key from localStorage it would be

window.localStorage.removeItem("somekey"); 

Easy as hell :)

Community
  • 1
  • 1
krishwader
  • 11,341
  • 1
  • 34
  • 51
  • 1
    For me session is maintained in server and document.cookie is not having any values. – Abin Koshy Cheriyan Jun 13 '13 at 20:00
  • The cookie value we can see in Firefox browser. The same is not coming in iPad Safari. I want to clear the session cookies and cache,and not set a cookie myself and clear it. The default safari cache needs to be cleared. – Abin Koshy Cheriyan Jun 13 '13 at 20:03