Change the Link for Header Image?

I know that the image link in the header defaults to the home page when clicked, but is there a way to alter that URL for certain menus?

For instance, the home page is no longer relevant for the logged-in users, but the Dashboard page is.

Any ideas?

Thanks!

Hi,

You could do it by having the current header link for non-logged in user (so let’s say the default url link of the header will be for non logged in users).

Then to change the header link for logged in users only, you should add this script in the app settings => custom code => header.

<script>
document.addEventListener('DOMContentLoaded', function() {
    if (window['logged_in_user']) {
        const logo = document.querySelector('.softr-nav-logo');
        if (logo) {
            logo.addEventListener('click', function(event) {
                event.preventDefault();
                event.stopPropagation();
                window.location.href = 'https://google.com'; //to be changed
            });
        }
    }
});
</script>

I have not tested it for all use cases but it should work. Let me know.

All of this is true if you are using the new navbar.

1 Like

Thank you so much for this!!

1 Like