[Solved] I want to add a back button on my website pages. Any ideas?

When we press this back button we should go to the previous page we have visited.

1 Like

Use the wix local-storage

can you please explain in more detail?

Page code:

import { session } from ‘wix-storage’;import wixLocation from ‘wix-location’;

$w(‘#button’).onClick(()=>{
wixLocation.to(session.getItem(“p”)) //this get the previous page url
})


masterPage.js

import { session } from ‘wix-storage’; import wixLocation from ‘wix-location’; $w.onReady(function () { session.setItem(‘p’, session.getItem(‘c’)) session.setItem(‘c’, wixLocation.url });


I use ‘p’ for the previous page

I use ‘c’ for the current page


Please format on your code side, no idea why I cannot format on my side :frowning:

ok thanks

1 Like

The Back Button example shows how to do this.

One question: is any way to “generate” an editor URL on our side? (Hope this will be a Wix partner feature)

@certified-code This is currently being evaluated.

1 Like

Wouldn’t it be easy if we could access the window-object in a button onClick-handler somehow? Then, the code would be:

window.history.back();