From 39d1aed274790593b6e10c03c8cbc42f3636a10d Mon Sep 17 00:00:00 2001 From: Jason Korth Date: Mon, 19 Mar 2018 17:15:46 -0500 Subject: [PATCH] Don't upgrade logout link if form doesn't exist (#39) 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') {