From 3e702d54ac69e74ec9b4f806602bca6c59351f53 Mon Sep 17 00:00:00 2001 From: Jason Korth Date: Wed, 28 Feb 2018 11:38:45 -0600 Subject: [PATCH] add a check to see if logout button exists before running the function fixes #38 --- javascript/betternavigator.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/javascript/betternavigator.js b/javascript/betternavigator.js index 8bf533f..7ba77d0 100755 --- a/javascript/betternavigator.js +++ b/javascript/betternavigator.js @@ -32,12 +32,14 @@ function initialiseBetterNavigator() { if (getCookie('BetterNavigator') === 'open') { BetterNavigator.className = 'open'; } - - // Upgrade logout link to directly log users out instead of redirecting to logout form - BetterNavigatorLogoutLink.onclick = function (e) { - e.preventDefault(); - BetterNavigatorLogoutForm.submit(); - }; + + if (BetterNavigatorLogoutForm) { + // Upgrade logout link to directly log users out instead of redirecting to logout form + BetterNavigatorLogoutLink.onclick = function (e) { + e.preventDefault(); + BetterNavigatorLogoutForm.submit(); + }; + } } if (document.addEventListener && document.readyState === 'loading') {