sessionStorage 브라우저 캐시

자세히 보기
    $("#int").on("search",function() {
        var $value = $(".sch input").val();
        arr.push($value);
        sessionStorage.setItem("data", arr)
        window.location.href = "/wap/searchgoods-index.html?search_keywords="+$value;
    })
    $(window).on("load",function(){
        var data = sessionStorage.getItem("data");
        if(data != null){
            data = data.split(",");
            data = remov(data);
            for(var i = 0; i < data.length; i++) {
                $(".hstl .hst").append("
  • "+data[i]+"
  • "); } }
    /* */ $(" .hstl .hst li").on("click",function() { var $value = $(this).html(); window.location.href = "/wap/searchgoods-index.html?search_keywords="+$value; }) })

     
    
    
    
        
        
        H5 storage
    
    
        
        
        
    
    
    
        //localStorage 
        function setItems(){
            var user = {};
            user.name = 'Adam Li';
            user.age  = 25;
            user.home = 'China';
            localStorage.setItem('userinfo',JSON.stringify(user));
        }
        //localStorage 
        function getItems(){
            var data = JSON.parse(localStorage.getItem('userinfo'));
            console.log("name:"+data.name+'\r age:'+data.age+"\r home:"+data.home);
        }
    
        //localStorage 
        function deleteItem(){
            localStorage.removeItem('userinfo');
            console.log(localStorage.getItem('userinfo'));
        }
    
    

    좋은 웹페이지 즐겨찾기