How to check browser is reloaded?

mohsinalisoomro

MOHSIN ALI SOOMRO

Posted on October 26, 2021

How to check browser is reloaded?

This is experimental feature

Check if the type===navigate then you just visit the website if type===reload then you reload the page

  //check browser reloaded then 
  function checkBrowserRelaoad() {
    // Use getEntriesByType() to just get the "navigation" events
    const perfEntries = window.performance.getEntriesByType("navigation");
    for (let i=0; i < perfEntries.length; i++) {
      const  p = perfEntries[i];;
      console.log(p?.type)
    }
  }
Enter fullscreen mode Exit fullscreen mode

👉 Reference link

💖 💪 🙅 🚩
mohsinalisoomro
MOHSIN ALI SOOMRO

Posted on October 26, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related