javascript更改get参数而不重定向 [英] javascript changing the get parameter without redirecting

查看:67
本文介绍了javascript更改get参数而不重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不重定向的情况下更改get参数?

How can I just change the get parameter without redirecting?

parent.location.search = "?after=20"; 
// ok that changes, but also redirect to the new page

任何解决方案?或者答案是否定的,如果不是,请写下大号。

Any solution? Or answer is no, if its no, please write big no.

推荐答案

更新



由于这是接受的答案,并且不再是真的,请参阅此重复的问题获取最新信息。

Update

Since this is the accepted answer, and no longer true, refer to this duplicate question for up to date information.

原始答案如下:

您可以接近URL的锚点部分,可以通过哈希访问位置的属性对象

You can come close with the anchor portion of the URL which is accessible by the hash property of the location object

parent.location.hash = "whatever value you want";

这篇关于javascript更改get参数而不重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆