history.go('url')问题 [英] history.go('url') issue

查看:207
本文介绍了history.go('url')问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了history.go()方法可以具有两种类型的参数:

I've seen that history.go() method can have two types of parameter:

请参阅:

 http://www.w3schools.com/jsref/met_his_go.asp 

但是url根本不起作用。

But url does not working at all.

我使用浏览器的JavaScript控制台测试此方法,但没有成功。

I use JavaScript console of browser to test this method but got no success.

我知道存在安全问题,您无法读取历史记录条目。

I know that there are security issues, that you can't read history entries. You can just go back and forward.

那么为什么在所有js引用中都列出了此字符串参数?

So why this string parameter listed in all js references?

推荐答案

将URL作为参数提供是一项非标准功能,并且并非在所有浏览器中都适用。大多数浏览器仅接受相对编号,例如 1 -1

Supplying a URL as a parameter is a non-standard feature and will not work in all browsers. Most browsers accept only a relative number, e.g. 1 or -1.

来自 MDC文档(重点是我的):


[ history.go(integerDelta)]从会话历史记录中加载页面,该页面由其相对位置标识到当前页面例如-1(表示上一页)或1(表示下一页)。当 integerDelta 超出范围时(例如,在会话历史记录中没有以前访问的页面时为-1),该方法不执行任何操作,也不引发异常。 不带参数或使用非整数参数调用 go()无效(与Internet Explorer不同,Internet Explorer支持将字符串URL作为参数)。

[history.go(integerDelta)] Loads a page from the session history, identified by its relative location to the current page, for example -1 for the previous page or 1 for the next page. When integerDelta is out of bounds (e.g. -1 when there are no previously visited pages in the session history), the method doesn't do anything and doesn't raise an exception. Calling go() without parameters or with a non-integer argument has no effect (unlike Internet Explorer, which supports string URLs as the argument).

当您使用 W3Schools时,会发生这种情况作为学习资源;-)

This is what happens when you use W3Schools as a learning resource ;-)

这篇关于history.go('url')问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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