When we press this back button we should go to the previous page we have visited.
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
ok thanks
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.
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();