views:

99

answers:

1

Hi Guys,

I am working on a web app for the iOS. When the app is opened, it check's to see if the user has a cookie with the users email stored in it, then either lets the user proceed to the homepage, or redirects the user to the authentication page.

This works perfectly when using safari. The problem I am experiencing occurs only when the app is stored on the home screen. It seems like the home-screen web app deletes the cookie right when the user exits the application.

Any advice on forcing the app to store that cookie would greatly appreciated.

Thanks, Peter

A: 

There is a parameter path for the setcookie function which you might want to use so that cookie is created just about from any page:

The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set in.

So try adding '/' as the fourth argument to the setcookie function eg:

setcookie("TestCookie", $value, time()+3600, "/");
I can't see anywhere in his comment any mention of PHP. Just wondering where you got that from.
Helen Neely
The question is tagged PHP
Scott Saunders
Thanks Asif,Thanks for the advice, the cookie path is already set to '/' though. Any other suggestions?And Helen, Sorry for not mentioning.... I am using PHP.Thanks Peter
Peter