From d98fb1409fdd2373b899a1370af477550490bd45 Mon Sep 17 00:00:00 2001 From: cglatot Date: Thu, 29 Oct 2020 09:29:41 +0000 Subject: Fix for Apple + Safari --- js/main.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index c0b7d11..cb23a7f 100644 --- a/js/main.js +++ b/js/main.js @@ -21,7 +21,15 @@ var libraryType = "shows"; // Sets whether the library is a show or a movie / ot $(document).ready(() => { // Check if there is a page refresh, if so we want to push the history without the # - let navigationType = performance.getEntriesByType("navigation")[0].type; + let navigationType; + if (window.performance && window.performance.getEntriesByType('navigation').length) { + navigationType = window.performance.getEntriesByType("navigation")[0].type; + } else if (performance.getEntriesByType('navigation').length) { + navigationType = performance.getEntriesByType("navigation")[0].type; + } + else { + console.log("Couldn't find the window.performance or performance to get reload information"); + } if ((navigationType == 'reload') && (window.location.href.indexOf('#authentication') == -1)) { window.history.pushState('', document.title, window.location.pathname + '#authentication'); } -- cgit v1.2.3