diff --git a/html/poketube.ejs b/html/poketube.ejs
index bfc970b6..91d214c0 100644
--- a/html/poketube.ejs
+++ b/html/poketube.ejs
@@ -1625,7 +1625,7 @@ if (/[?&]autoplay=/.test(location.search)) {
const refreshPage = () => {
location.reload();
};
-
+
// Check if a timer is already set in localStorage
const timer = localStorage.getItem('refreshTimer');
@@ -1634,13 +1634,21 @@ if (timer) {
clearTimeout(timer);
}
-// Set a new timer to refresh the page after 1 hour
+// Check if it's the first time the user visits the page
+const isFirstLoad = localStorage.getItem(userlocalStorageKey) === null;
+
+// Set a new timer to refresh the page after 1 hour or on the first visit
const newTimer = setTimeout(() => {
refreshPage();
-}, 60 * 60 * 1000); // 1 hour in milliseconds
+}, isFirstLoad ? 0 : 60 * 60 * 1000); // 1 hour in milliseconds
// Save the new timer in localStorage
localStorage.setItem('refreshTimer', newTimer);
+
+// Save the first load flag in localStorage if it's the first visit
+if (isFirstLoad) {
+ localStorage.setItem(userlocalStorageKey, 'visited');
+}