문제

Hey i'm using the following code to set a cookie and get it :

  $.cookie('SimMobileUsername', $('#user_id').val());

  if($.cookie('SimMobileUsername') != "null" && $.cookie('SimMobileUsername') != null); {

    $('#user_id').val($.cookie('SimMobileUsername'));

    }

Which works fine but when i add the webpage to the home screen it dosen't save the cookie.

Important:

I have read that safari caches home screen pages, so i tried the following code to refresh the page on 1 time on start but that didn't help either:

 var url = window.location.href;
if (url.indexOf('rnd=') == -1) {
    url = (url.indexOf("?") == -1 ? url + "?rnd=" : url + "&rnd=") + Math.random();
    window.location.href = url;
}

Any insights on the subject?

도움이 되었습니까?

해결책

In the end i solved it using localStorage in ios instead of cookie, if someone is to answer the question correctly i'll mark his as the right answer.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top