DEV Community

MOHSIN ALI SOOMRO
MOHSIN ALI SOOMRO

Posted on

2 1

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)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay