From cb6ab0f41ca5b30fd98cad6167a7e10a9a120f6b Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Mon, 10 May 2021 21:46:24 +0300 Subject: [PATCH] Fix back on load [Tizen 2.x] --- src/components/appRouter.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/appRouter.js b/src/components/appRouter.js index db1e68048f..9908caecda 100644 --- a/src/components/appRouter.js +++ b/src/components/appRouter.js @@ -30,8 +30,16 @@ class AppRouter { startPages = ['home', 'login', 'selectserver']; constructor() { - window.addEventListener('popstate', () => { - this.popstateOccurred = true; + // WebKit fires a popstate event on document load + // Skip it using timeout + // For Tizen 2.x + // https://stackoverflow.com/a/12214354 + window.addEventListener('load', () => { + setTimeout(() => { + window.addEventListener('popstate', () => { + this.popstateOccurred = true; + }); + }, 0); }); document.addEventListener('viewshow', () => {