0
 Followers
1
 Like

Back Button for Back in Browser History

Frontend
New

Sometimes we have to go back to a previous page.

We can do it in 3 ways:

1 - A button that has a specific link!

For example, I'm in a page with a List of Employees, and click in one of the Employees in the list, going to his Detail Page. There I have a button saying back that goes back to the list.

The problem of this solution is that If I can access the same page from a different place, when I click the back button I go to the Employee List Page and not to the page I was.


2 - A button that runs a Javascript!

I can have a button that runs the following javascript :

        window.history.back(); 

        return false;

This reproduce the back button web browser behavior.

The problem of this solution, are the Pop-Ups. If you open a Pop-Up in the page you are and run the javascript above, it goes back to the same page again. So in the end you stay in the same page.


3 - You can pass the Original URL as a parameter.

If you pass the Original URL as an input parameter of the next page you will access, you can always redirect the user to this URL again through a button or a link.


The idea is to make this a pattern!

OutSystems pages could always receive this Original URL input parameter behind the hood.

And could exist a component that would be a button or link that when clicked, redirects the User to this hidden URL.


This way we can always have the possibility to send the User back to the previous page!

Created on 12 Apr
Comments (1)

Changed the category to Frontend


views
217
Followers
0