mgrubinger / blog

https://www.grooovinger.com/
MIT License
0 stars 0 forks source link

Was the page navigated to using back or forward button? #23

Open mgrubinger opened 1 year ago

mgrubinger commented 1 year ago

date: '2021-01-12' short: 'using PerformanceNavigationTiming.type'

window.performance.getEntriesByType("navigation")[0].type === "back_forward";

This is how to detect if a page was loaded because the user navigated via back or forward buttons.

Possible values:

See PerformanceNavigationTiming.type on MDN