Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Navigation - back

Questions related to using nuBuilder Forte.
Locked
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Navigation - back

Unread post by Timo »

How to make the navigation more intuitive to go to previous bookmark when the browser's back button is clciked?
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Navigation - back

Unread post by admin »

Timo,

I don't understand your question.

Steven
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: Navigation - back

Unread post by Timo »

Sorry I mean breadcrumb
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Navigation - back

Unread post by admin »

Timo,

Sorry, but more intuitive Is a pretty open-ended thing to say, so I still don't understand what you mean.

Steven
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: Navigation - back

Unread post by Timo »

Users expect the back button to take them back to what they perceived to be their previous page.

Back button:
Image

Example: Edit form is open, user hits the browser's back button. Expectation: Takes you back to the Browse form. What happens: Nothing.
Take Joomla as an example: The browser's back button works as expected (takes you to the previous page). Additionaly, breadcrumbs can be used, too.
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Navigation - back

Unread post by admin »

Timo,

The back button reloads a whole web page - nuBuilder rebuilds pages without reloading a new page.

If your users find this an insurmountable problem you have two choices.

1. Fork nuBuilder and make the changes you want.
2. Try to get Joomla to do what nuBuilder does.

Steven
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Navigation - back

Unread post by toms »

Here's another option: This will "disable/intercept" the browser's back button and take you back to the previous breadcrumb:

Add this js under Home ► Setup ► Header:

Code: Select all

function gotoPrevBreadcrumb() {
    var l = window.nuFORM.breadcrumbs.length;
    if (l > 1) {
        nuGetBreadcrumb(l - 2);
    }
}

function nuOnLoad() {

    window.history.pushState({ page: 1}, "", "");
    window.onpopstate = function(event) {
        if (event) {
             gotoPrevBreadcrumb();
        } else {}
    };
}  
toms
Posts: 785
Joined: Sun Oct 14, 2018 11:25 am

Re: Navigation - back

Unread post by toms »

Small improvement: Works also if a modal window is open.

Code: Select all

function gotoPrevBreadcrumb() {

    if (parent.$('#nuModal').length > 0) {
        nuClosePopup();
        return;
    }

    var l = window.nuFORM.breadcrumbs.length;
    if (l > 1) {
        nuGetBreadcrumb(l - 2);
    }
}


function nuOnLoad() {

    window.history.pushState({ page: 1}, "", "");
    window.onpopstate = function(event) {
        if (event) {
            gotoPrevBreadcrumb();
        } else {
        }
    };
  
}
Timo
Posts: 217
Joined: Thu Mar 15, 2018 9:26 pm
Has thanked: 1 time

Re: Navigation - back

Unread post by Timo »

@Steven: Forking nuBuilder for just that function is no option for me. And to migrate all my projects to joomla just because of a function that is not there is no option either.
@toms: This is exactly what I was looking for :D This should be included in nuBuilder.@
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: Navigation - back

Unread post by admin »

.
Locked