I'm working on a mobile commerce website, and the nav pages have an annoying quirk.
The nav page for each product category shows links for all the subcategories that work pretty much as you'd expect, except for the "Show All" subcategory. If the user clicks that link, instead of navigating off-page, the subcategory menu collapses and the first page of products (which was there but cleverly hidden all along) is revealed.
The problem is that if the user visits a product off of that page and goes back, the page resets itself to its "Show-Nav-Don't-Show-Products" state -- not what the user is expecting. I could set a cookie telling that page to stay "Show-Products-Don't-Show-Nav" once it has been put into that state, but that creates non-intuitive behavior if the user navigates back via other means (such as the breadcrumbs, or re-visiting the home page) and would like to see the subcategories list instead of the products.
I tried setting a hidden
field on the nav page that gets set when you expand the products, on the theory that it will retain its value if you visit the page via "Back" but will get reset if loaded any other way. That only works in Chrome; it doesn't work in Safari and other mobile browsers.
I'd settle for something that detects when the user is visiting the page via the Back button and makes what should be a pretty accurate guess about what state the user is expecting, but questions like this one (Can I detect when a user gets to a page using the back button?) make me think there's no good way to actually detect when a user has arrived via the back button.
Obviously, this is not a good design. But given that my job is hunting bugs, I'm looking for the lowest-impact solution I can manage to minimize both the time I spend on it and the chance of regression errors, so refactoring the code isn't a good solution.
Does anybody have any ideas for how they'd approach this problem? For what it's worth, I do have access to jQuery on this page.