I am trying to find out if its the users first time on my webpage. I am currently storing a variable in local storage and checking if its null or not but it doesn’t seem to work in Internet Explorer. What other method can I use to accomplish this?
var str_count = localStorage.getItem("count");
if (str_count == null || str_count == "null")
{
// Do something
}
Setting
cookiewith long expiration date is definitely more reliable that usinglocalStorageas it is not yet supported by older browsers.Check this code:
Read more about cookies here.