2

I am building an e-commerce site where the product page changes product variants by changing the select box which value reflects in the URL using window.location.href - so far, so good.

My URL has this format (the only thing that changes between variants is what goes after the hash) http://www.myecommerce.com/myproductpage#!#product=15647

The issue happens when clicking the native browser's back button, instead of returning back to the previous hash it reloads the same partial of page (the URL stays the same). The partial is loaded through post request.

I don't use any angular routing.

It would be hard for me to share a demo as the issue only happens after the AJAX request.

1 Answer 1

1

Try to change your URL style to something like that: ../myproductpage#/product/15647 You can use the angular router or the ui router (my preferred one) to do a correct routing. It seems that the browser inteprets the second hash tag as an anchor and doesn't navigate.

Sign up to request clarification or add additional context in comments.

1 Comment

I also prefer ui-router : i would suggest him to read github.com/angular-ui/ui-router/wiki/URL-Routing how he can make a state and assosiate with url /product/:productId to read out the parameter productId. and showing diffrent products with angular depending on the value of the parameter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.