Not being directed to the correct page

Hi,

On my website if user navigates to Main Category page > Sub Category filter > Item Page

If they click back on their browser I want them to be directed to the Sub Category filter page they were in prior to selecting the item. Note: The Main Category and Sub Category are on the same page. This is the URL https://www.easternstyles.com/electronics-gadgets

for the main category page. This is the code below and a video of whats happening on the site.

import wixData from ‘wix-data’;

$w.onReady(function () {
//TODO: write your page related code here…

});

export function Batteriesplugs_click() {
$w(‘#dataset1’).setFilter(
wixData.filter()
.contains(‘subCategory’, “Batteries, Plugs”)
);
}
export function Clocks_click() {
$w(‘#dataset1’).setFilter(
wixData.filter()
.contains(‘subCategory’, “Clocks”)
);
}
export function Headphonesspeakers_click() {
$w(‘#dataset1’).setFilter(
wixData.filter()
.contains(‘subCategory’, “Headphones / Speakers”)
);
}
export function Torchdiscolightsled_click() {
$w(‘#dataset1’).setFilter(
wixData.filter()
.contains(‘subCategory’, “Torch, Disco lights, LED”)
);
}
export function Electronics_click() {
$w(‘#dataset1’).setFilter(
wixData.filter()
.contains(‘topCategory’, “Electronics”)
);
}

Hi Nathan,
From what I’ve inspected it is directing to the correct page.
As you said, the main category page is the same as the sub category page + filter.
My is suggestion is to split those pages in to real pages. that way the browser will do it correctly.
Try Dynamic page filtered by category.
Good luck!
Roi

Hi Roi,
Thanks for your response. Unfortunately, that would mean that I have to create an additional 150 + pages on my site since I have a lot of sub categories. I am trying to keep everything condensed at the moment. Is there any other solution you can think of instead of those additional pages? Thanks

Hi Nathan,
Instead of creating 150+ pages, create one Dynamic page.
Roi