I am currently working on a web site and came across the following problem:
Assume my websites name is www.mysite.com.
On the first call of the page, my JavaScript checks, whether there are certain parameters in the URL, that are important for the web applications state. Those parameters are for example:
lang - language --> lang=1 means German
page - current Page --> page=home means its the homepage
cats - categories --> cats=1,2,3 means that the default categories are 1,2 and 3
If you just call www.mysite.com, the script detects, that no parameters are set. It will then set the default parameters. Based on URL modifications with the hashmark, i set the URL to:
www.mysite.com/#/page=home&lang=1&cats=12,13,18
The real problem about this is, that inside the browser history two states are set. The first is www.mysite.com and the second the complex URL with the parameters.
So imagine I am currently at
www.mysite.com/#/page=home&lang=1&cats=12,13,18
and press the return button now. The browser brings me to
www.mysite.com
and then my Javascript detects, that there are no parameters, so it takes me again to
www.mysite.com/#/page=home&lang=1&cats=12,13,18
How to solve this? Is it possible to manage the history completely manually, so that i could push each state by my JavaScript?
Thanks!