Hello everyone! I trying to make redirect from product page (for one of products) to another page with working browser button back) This code I have get in Wix support, but its doesn't working... Maybe somebody knows what the problem in this code?
import wixLocation from 'wix-location';
$w.onReady(function () {
//Code for application pages
wixLocation.onChange((location) => {
let newPath = '/' + location.path[0] + '/' + location.path[1];
console.log("New product URL: ", newPath);
if (newPath === '/product-page/Gelandewagen6x6') {
wixLocation.to('/gelik6x6');
}
});
});
Hello. Here i get it)
I need to be redirected from some products to other pages, and what is very important - when you click on the back button (browser button), the person gets back to the store, and not to the redirected page.
It's just that I already have a redirect, but when you click back, the person gets to the redirected page and redirects him again - this is not very good.
Where from Wix Support did you get this code?
What exactly are you trying to accomplish? What doesn't work?