History.go

How can I use history.go to return some page ?

I’m try to use in click option but It doesn’t work.

  1. Add a Browser component to the page.
    image
  2. For the mouse on-click event action
  3. Choose the Browser Go To. For the Properties click the Dynamic Binding button
  4. Choose Referrer
  5. And you are done.
2 Likes

the line looked like this:

But, it doesn’t work.

Why ?

Are you applying this to a single page app?

Im use with two diferente pages, but in first page I’m working with modal page. Whem I’m use back button of the browser works normally, but whem I’m use back button like as you teached don’t works.

There has to be something in your setup/code that is stopping the widget from working. Is it possible for you to publish the site and supplying the link to it? That way we can see what is going on.

Thanks I will think how I can share this code with you.

Why not just use an anchor button and set the link to javascript:history.back() ?

<a href="javascript:history.back()" class="btn btn-sm btn-outline-warning">Back</a>

I’m tried to use just “history.back()” but doesn’t work I will try to use “javascript:history.back()”

thanks

I imagine .htaccess url rewrite code impacts this, too.

But, since javascript can handle a million problems, whether angular, express, react, etc. I came across an article using an angular approach that works with Single Page Apps.

It should be duplicatable using Wappler's components, too.

This one is a whole repository of files to create a "fool proof" history that doesn't refer to the browser's history and can retain the explicit url with the # anchor tag.

Probably every website has a back button. How should this button work? Basically, when we get a new URL address we get a new page, this URL saves in browser history. Using this history we can go back and forth. What about spa applications like angular? Most of the time in angular we have a static route but we change the inner component on the current page.

It will be good to have a back button on our website. What can we do? Standard browser history will not work for us. We can write our own service that will listen when a user changes route in our angular application. The new route will be saved, when the user clicks on the back button we give the last saved item.

Our angular application has three routes. Each component just shows the current location.

And another approach that should be duplicatable with Wappler's components --

Works!!! Thanks for all

1 Like

@funchal
Now I’m curious . . .
What “worked”?
How did you solve your problem?
It would be useful to put into the bag of Wappler procedures for an often-encountered situation.

He replied to this comment:

And that is what has worked for him.

Works for me :

<a href="javascript:history.back()" class="btn btn-sm btn-outline-warning">Back</a>

I’m tried to use “javascript:history.back()” in the click action of button but doesn’t worked.