1

我有滚动文字的闪光。每个词都与http://www.foo.bar/somepage.html#parametar

所以“word1”链接到http://www.foo.bar/somepage.html#parameter1,

word2 链接到http://www.foo.bar/somepage.html#parameter2等。

当我在“somepage.html”之外的所有其他页面上时,这有效。

当我在“somepage.html”上时它不起作用。参数只是附加到 url,但页面没有再次加载。

这是我的代码:

on(release)
{
    getURL("http://www.foor.bar/somepage.html#parameter");
}

我尝试过设置 _self、_top、_parent 窗口,什么都没有。它只适用于 _blank,但这不是我想要的。

如何在不打开新窗口的情况下强制页面加载?

谢谢!

4

1 回答 1

1

The problem is that hash fragments (the text after the # symbol) do not cause a page refresh on their own, so if you are already on somepage.html, the browser won't refresh automatically.

The solution is to use some JavaScript on the page to detect the change to the hash fragment and trigger a page refresh. Ben Alman has written a jquery plugin that gives you cross browser support for detecting these changes.

于 2011-11-10T09:30:58.150 回答