最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jQuery -> Change Window.href - Stack Overflow

programmeradmin5浏览0评论

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 badges
Add a ment  | 

2 Answers 2

Reset to default 6

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

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

评论列表(0)

  1. 暂无评论