DEV Community

MOHSIN ALI SOOMRO
MOHSIN ALI SOOMRO

Posted on

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

Top comments (0)