Ian Vink
Ian Vink

Reputation: 68750

jQuery -> Change Window.href

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';

Upvotes: 2

Views: 6272

Answers (2)

Jacob Relkin
Jacob Relkin

Reputation: 163248

Try something like this: window.location.href = window.location.pathname + 'SomeString';

Upvotes: 6

CodeJoust
CodeJoust

Reputation: 3800

var loc = window.location + '';
window.href = loc.replace('(\?(.+))','') + str;

Upvotes: 0

Related Questions