diff --git a/src/Yesod/Auth/Facebook/ClientSide.hs b/src/Yesod/Auth/Facebook/ClientSide.hs
--- a/src/Yesod/Auth/Facebook/ClientSide.hs
+++ b/src/Yesod/Auth/Facebook/ClientSide.hs
@@ -84,10 +84,11 @@
                  (Route Auth -> Route master)
               -> GWidget sub master ()
 facebookJSSDK toMaster = do
-  (lang, fbInitOptsList, muid) <-
-    lift $ (,,) <$> getFbLanguage
-                <*> getFbInitOpts
-                <*> maybeAuthId
+  (lang, fbInitOptsList, muid, ur) <-
+    lift $ (,,,) <$> getFbLanguage
+                 <*> getFbInitOpts
+                 <*> maybeAuthId
+                 <*> getUrlRender
   let loggedIn = maybe False (const True) muid
       loginRoute  = toMaster $ fbcsR ["login"]
       logoutRoute = toMaster $ LogoutR
@@ -136,6 +137,17 @@
         }
       });
     }
+
+    // Logout function
+    window.$$yfblogout = function () {
+      FB.getLoginStatus(function(response) {
+        if (response.status !== 'connected' ||
+            FB.logout(function () {}) === undefined) {
+          window.location.href = #{A.toJSON (ur (toMaster LogoutR))}
+        }
+      });
+      return (function () {});
+    };
    |]
 
 
@@ -185,21 +197,20 @@
 
 
 -- | JavaScript function that should be called in order to logout
--- the user.  You could splice this into a @onclick@ event, for
--- example:
+-- the user.  You could splice the result of this widget into a
+-- @onclick@ event, for example:
 --
 -- @
 --   \<a href=\"\#\" onclick=\"\#{facebookLogout}\"\>
 --     Logout
 -- @
 --
--- You should not call this function if the user is not logged
--- in.
---
--- This is only a helper around Facebook JS SDK's @FB.logout()@,
--- you may call that function directly if you prefer.
+-- This function used to be just a helper around Facebook JS
+-- SDK's @FB.logout()@.  However, now it performs a check to see
+-- if the user is logged via FB and redirects to @yesod-auth@'s
+-- normal 'LogoutR' route if not.
 facebookLogout :: JavaScriptCall
-facebookLogout = "FB.logout(function () {})"
+facebookLogout = "window.$$yfblogout()"
 
 
 -- | A JavaScript function call.
diff --git a/yesod-auth-fb.cabal b/yesod-auth-fb.cabal
--- a/yesod-auth-fb.cabal
+++ b/yesod-auth-fb.cabal
@@ -1,5 +1,5 @@
 Name:                yesod-auth-fb
-Version:             1.5
+Version:             1.5.1
 Synopsis:            Authentication backend for Yesod using Facebook.
 Homepage:            https://github.com/meteficha/yesod-auth-fb
 License:             BSD3
