更新浏览器网址而不重新加载 [英] update browser url without reload

查看:102
本文介绍了更新浏览器网址而不重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想更新浏览器网址而不提交网页。网址可以是任何内容,例如xyz ..请帮助我。谢谢。



这是我到目前为止所做的。

Hi,

I want to update browser url without page being submitted.The URL can be anything, like xyz..Please help me.Thanks in advance.

This is what i have done so far.

//            if (history.pushState) {
//                // The first is an object that you will use to identify the history entry later, the second is referred to as the 'title' parameter
//                //The final parameter is the URL you want to link the new state to. This doesn't have to exist on the server, and it can be relative or absolute, however, 
//                //as with AJAX, you cannot use a domain other than the current one. 
//                window.history.pushState({ "html": response.html, "pageTitle": response.pageTitle }, "", urlPath);
//            }
//            else {
//                window.location.pathname = urlPath;
//                // window.history.pushState({ "html": response.html, "pageTitle": response.pageTitle }, "", urlPath);
//            }





但是页面重新加载使用它。为什么?任何人都可以帮助我



But the page reloads by using this. Why ? can anyone help me

推荐答案

所以基本上你正在尝试构建一个页面,在加载之后,它将显示一个与页面完全不同的URL。原来装的是?如果是这种情况,那对我来说听起来很可疑,因为它似乎是试图欺骗攻击 [ ^ ]。

请详细告诉我们什么它实际上是你要做的。



如果这是一次黑客攻击,那么你在CP上就没有运气了支持这种行为。



问候,

- Manfred
So essentially you are trying to construct a page that will, after it has been loaded, show a completely different URL than the one the page was originally loaded from? Should this be the case then it sounds very suspicious to me as it seems like an attempt of a spoofing attack[^].
Please tell us in more detail what it is you're actually trying to do.

If this turns out to be an attempt at hacking, you'll have no luck here on CP as we don't support this kind of behaviour.

Regards,
— Manfred


这篇关于更新浏览器网址而不重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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