1 <script type="text/javascript"> 2 var ua = navigator.userAgent.toLowerCase(); 3 if (/iphone|ipad|ipod/.test(ua)) { 4 //alert("iphone"); 5 } else if (/android/.test(ua)) { 6 var alertmessage="温馨提示:您可以在右下角的菜单中下载最新版本的手机版APP哦!\n \n本提示只出现一次!" 7 var once_per_session=1 8 function get_cookie(Name) { 9 var search = Name + "=" 10 var returnvalue = ""; 11 if (document.cookie.length > 0) { 12 offset = document.cookie.indexOf(search) 13 if (offset != -1) { 14 offset += search.length 15 end = document.cookie.indexOf(";", offset); 16 if (end == -1) 17 end = document.cookie.length; 18 returnvalue=unescape(document.cookie.substring(offset, end)) 19 } 20 } 21 return returnvalue; 22 } 23 function alertornot(){ 24 if (get_cookie(‘alerted‘)==‘‘){ 25 loadalert() 26 document.cookie="alerted=yes" 27 } 28 } 29 function loadalert(){ 30 alert(alertmessage) 31 } 32 if (once_per_session==0) 33 loadalert() 34 else 35 alertornot() 36 } 37 </script>
其实就是记录cookie。
时间: 2024-12-11 01:41:52