I am logged in my website e-commerce, and when I switch language: to Catalan for example, I lose my connection to the account,
I'm trying to keep the current account session with my rticles in my cart.
In fact, if i do it on normal browser, and i switch from language to another, all is good,
but the problem comes when i work on the private browser,
and here is my code in script,
- function changeLang(culture, subdomain) {
- var url = window.location.href;
-
- var alternate = $('head').find('link[rel="alternate"][hreflang="' + culture + '"]');
- if (alternate && alternate[0]) {
- url = alternate[0].href;
- }
- else {
- var hostName = window.location.hostname.replace(window.location.hostname.split('.')[0], subdomain);
- url = url.replace(window.location.hostname, hostName);
- }
- createCookie('IdKids.Culture', culture, 180);
- window.location = url ;
-
- }
so how can i fix this problem, to keep my current connexion ?