How would I use jQuery to redirect the page to teh base page + some string?
Specifically, I need to set the window.href = current page without params + 'SomeString';
How would I use jQuery to redirect the page to teh base page + some string?
Specifically, I need to set the window.href = current page without params + 'SomeString';
Share Improve this question edited Dec 21, 2009 at 0:54 Jacob Relkin 163k33 gold badges351 silver badges321 bronze badges asked Dec 21, 2009 at 0:51 Ian VinkIan Vink 68.9k107 gold badges353 silver badges567 bronze badges2 Answers
Reset to default 6Try something like this:
window.location.href = window.location.pathname + 'SomeString';
var loc = window.location + '';
window.href = loc.replace('(\?(.+))','') + str;