Lets say i've got the following url;
http://www.domain.com/en-US/assortment/en-US/category/page.aspx?sub=GROUP7
As you can see I have two language layers in the url from which I want to remove ONLY the second one. So I expect the url to be like this.
http://www.domain.com/en-US/assortment/category/page.aspx?sub=GROUP7
Due to technical limitations I don't have any other ways to modify the url. Can this be achieved with jQuery or Javascript? If yes, how?
Because you are referring a language code, I'll write a javascript code to catch generic language code and replace the duplication.
You can do this easily with regular expressions. check this out
the parameter inside the join method is essential.
This should work on most of the language codes currently in use.
Check out the JavaScript replace function.
Well, using the replace function, you can do something ugly like this:
I didn't really take time to make this cleaner - I'll clean it up in a few minutes.