分享至

var code = 'zh'; var dataid=352551; //浏览器是否支持localStorage if (window.localStorage) { var storage = window.localStorage; var readdata = localStorage.getItem(code); if (readdata != null && readdata !== undefined && readdata != "") { var isExist = readdata.split('|').some(function (_id) { return _id == dataid; }) if (!isExist) { storage.setItem(code, readdata + "|" + dataid); update(code, dataid); } } else { storage.setItem(code, dataid); update(code, dataid); } }; function update(code, dataid){ fetch('https://mip.dishen.com/article/count/?code='+code+'&id='+dataid) .then(function (res) { //console.log('数据请求成功!') }) }