I already have a working script which works well. I toned it down to only execute when width is smaller than 1024px. But I was wondering if it's possible to execute it only when clicking the back button from specific page, eg /products? I don't even know how to go about it, tried few ways but no success. Current script:
window.addEventListener( "pageshow", function ( event ) {
if($(window).width() < 1024) {
var historyTraversal = event.persisted || ( typeof window.performance != "undefined" && window.performance.navigation.type === 2 );
if ( historyTraversal ) {
window.location.reload();
}
}
}