Localstorage not working on android.

Localstorage not working on android.

I have a weird issue getting localstorage working on JQM.
My code works perfectly fine viewed on a web browser, however on my android it will not receive the data from localStorage.getItem('visittime') to detect time and compare for deletion

  1. $( document ).on( "pagecreate", function() {
  2.     var now = new Date().getTime(),
  3.         storagedate = localStorage.getItem('visittime');
  4.     if(storagedate){
  5.         var diff = now - storagedate;
  6.         if(diff > 60000){
  7.             localStorage.removeItem('visited');
  8.             localStorage.removeItem('visittime');
  9.         }
  10.     }
  11.     var yetVisited = localStorage.getItem('visited');
  12.     if (!yetVisited) {
  13.         $(".welcomewindow").delay(1500).fadeIn("300", function(){
  14.             $(".welcome").css({"margin-left":leftPos,"width":welcomeSetwidth}).fadeIn("300") ;
  15.         });
  16.         $(".welcomeClose").on("click",function(e){
  17.             $(".welcomeshield").fadeOut("300");
  18.             $(".welcome").fadeOut("300");
  19.             localStorage.setItem('visited','yes');
  20.             localStorage.setItem('visittime', new Date().getTime());
  21.         });
  22.     }
  23. }

    I saw people having somewhat similar issues that resolved it by changing the location of their script to be called before JQM loads or on mobileinit. I haven't been able to figure this out.