javascript更改get参数而不重定向

编程入门 行业动态 更新时间:2024-10-22 22:52:40
本文介绍了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参数而不重定向

本文发布于:2023-11-01 11:47:04,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549259.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:而不   重定向   参数   javascript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!