javascript判斷瀏覽器訪問,刷新,返回


話不多說,直接上

if (window.performance.navigation.type === 0/* 正常訪問 */) {
  // 你要干的事
} else if (window.performance.navigation.type === 1/* 刷新 */) {
  // 你要干的事
} else if (window.performance.navigation.type === 2/* 返回 */) {
  // 你要干的事
} else {
  // 其他你要干的事
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM