# Common Logout

**URL:** <https://forums.knack.com/t/common-logout/19804>\
**Category:** Get Answers\
**Created:** [August 28, 2025, 9:53am UTC](https://forums.knack.com/t/common-logout/19804 "2025-08-28T09:53:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastien\_Duke](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Sebastien\_Duke](https://forums.knack.com/u/Sebastien_Duke)\
**Post date:** [August 28, 2025, 9:53am UTC](https://forums.knack.com/t/common-logout/19804/1 "2025-08-28T09:53:23Z")

</div>

Hi guys! I’m very new to Knack and would appreciate some help here.

The app has multiple roles ( multiple protected pages ), I’ve used a “General Login“ (/login) so that users can go through one login page and be redirected based on their role.

But when logging out, I’m sent back to the login page of that page (e.g /role-dashboard-login) rather than going back to the general login. Oh and I can’t find where to do custom JS (only CSS) and as comfortable as I am with JS, I’d love to keep it within Knack unless really necessary.

Thank you guys!

---

<div class="post-metadata">

**Author:** ![CarlHolmes](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/carlholmes/32/2814_2.png) [@CarlHolmes](https://forums.knack.com/u/CarlHolmes)\
**Post date:** [August 28, 2025, 7:09pm UTC](https://forums.knack.com/t/common-logout/19804/2 "2025-08-28T19:09:33Z")

</div>

Hi @Sebastien_Duke - Welcome to the forum 👋

Straight off the bat - I’m not a coder 👨‍💻

What you’re running into depends on whether your app is built in Classic or the new Next Gen version. Given the fact that you’re missing the JavaScript section I think you’re on Next Gen.

- Next Gen (the new React version): At the moment, only custom CSS is supported – no JavaScript yet. That means it isn’t possible right now to override the logout redirect to always go back to your General Login page.

- Classic (the existing jQuery version): This is possible. With a little bit of custom JavaScript, you can catch the logout action and send users back to /login instead of the role-specific login page.

If you were on Classic, (according to my good friend, ChatGPT ), you could do something like this. I’m sure you know better than me.

```auto
$(document).on('knack-scene-render.any', function(event, scene) {
  $('a.kn-log-out').off('click').on('click', function(e) {
    e.preventDefault();
    Knack.logout();
    window.location.href = '/login'; // Always go back to General Login
  });
});

```

If you’re on Next Gen, this isn’t possible yet – Knack are currently working on introducing JavaScript.

Not a lot of help I’m afraid 🤔

You may find this thread of interest.

> [@Redirect Users on Logout](https://forums.knack.com/t/redirect-users-on-logout/11033):
>
> Is there an easy way to redirect users back to a specific page upon logout? Right now, I use the following: $(document).on("knack-view-render.view\_\*\*\*\*", function (event, view, data) { // Login Page to Redirect window.location.replace("\*\*destination\*\*"); // Destination Page }); This works, but I have to have this full code for each and every login page. Is there another option I can use that will allow me to not have to repeat this over and over again? Thanks!

---

<div class="post-metadata">

**Author:** ![Adrian\_vD](https://avatars.discourse-cdn.com/v4/letter/a/f08c70/32.png) [@Adrian\_vD](https://forums.knack.com/u/Adrian_vD)\
**Post date:** [September 3, 2025, 4:06am UTC](https://forums.knack.com/t/common-logout/19804/3 "2025-09-03T04:06:30Z")

</div>

Hi @Sebastien_Duke

Much like what Carl has put above this is the code I have been using on Classic to get the redirect.

```auto
/* Change the scene_1 to the scene key of your choice, or replace with any to work on all pages. */
$(document).on('knack-scene-render.any', function(event, scene, data) {
  $("a.kn-log-out").on("click", function() {
    // Some browsers need some wait-time to finish the logout
    setTimeout(function(){
        // replace with your desired URL
        window.location = "https://yoursite.knack.com/ ***** /";
    }, 500);
  })
});

```

---

<div class="post-metadata">

**Author:** ![Sebastien\_Duke](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@Sebastien\_Duke](https://forums.knack.com/u/Sebastien_Duke)\
**Post date:** [September 4, 2025, 3:43am UTC](https://forums.knack.com/t/common-logout/19804/4 "2025-09-04T03:43:54Z")

</div>

Hi guys, thank you so much for the reply. Yep, I am using the Next Gen page builder. if any of you may know if there is a timeline to when JavaScript might be coming to knack?

---

<div class="post-metadata">

**Author:** ![CarlHolmes](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.knack.com/carlholmes/32/2814_2.png) [@CarlHolmes](https://forums.knack.com/u/CarlHolmes)\
**Post date:** [September 4, 2025, 7:00am UTC](https://forums.knack.com/t/common-logout/19804/5 "2025-09-04T07:00:33Z")

</div>

No time line has been published, that I’ve seen. I’d imagine it will be over the next few months - maybe 🤷‍♂️
