0

I have a select item with bunch of cities on my website. When the visitor selects some city this happens:

$("#city-selector").change(function() {
    var url = $(this).val(); // get selected value
    if (url) { // require a URL
        document.location.href = url; // redirect
    }
});

Each option inside the select has a value parameter that contains subdomain url in it. The problem is document.location.href doesn't behave like a simple link. It clears visitor id and it looks like the visitor doesn't have a referer and came to the new subdomain out of nowhere. Is there a problem with functions I use or should I dig into crossdomain sessions/cookies? How do I make it behave properly?

1 Answers1

1

Use window.location.href. This is similar when clicking a link

window.location.href = url;
Bluetree
  • 1,324
  • 2
  • 8
  • 25