why window.location appending instead of replacing the URL in ie

If you set like this: window.location.href = '/yourpage'

it will append the url. To avoid that use // instead of /

so it will look like :window.location.href = '//yourpage'


window.location isn't a string, I'd be very careful with using it that way - it's actually a Location object.

Maybe this will help you:

var href = window.location.href;
window.location = href.replace(/testing\/.*$/, "testing/"+$('#text-search').val());

You can also do:

var href = "" + window.location;

to force the string cast, and pass-by-value.