Javascript jQuery地址无法刷新
我使用Asual的jQuery地址插件在内容之间进行深度链接,而不使用散列(使用HTML5历史API) 这是我的密码:Javascript jQuery地址无法刷新,javascript,jquery,browser,browser-history,Javascript,Jquery,Browser,Browser History,我使用Asual的jQuery地址插件在内容之间进行深度链接,而不使用散列(使用HTML5历史API) 这是我的密码: $.address.state("/").init(function(e){ $('#nav li a').address(); // initializes if (e.value == "/") { $.address.value("/home"); // loads /home by default }; }); $.addres
$.address.state("/").init(function(e){
$('#nav li a').address(); // initializes
if (e.value == "/") {
$.address.value("/home"); // loads /home by default
};
});
$.address.change(function(e) {
// loads whatever page is in that /pages folder and puts the content in div#container
$.get("/pages" + e.value + ".html", function(data, textStatus, xhr) {
$('#container').html(""); //clears out the old content
$('#container').html(data); //loads the new page in there
});
});
当单击顶部导航按钮时,此操作非常有效。甚至浏览器中的“后退”和“前进”按钮也像一个符咒。问题是在另一个选项卡中刷新/打开url时。
例如,如果我写了它,我就会看到它的内容。如果我刷新,就会出现404错误。浏览器正在查找一个实际的/home文件,该文件当然不存在(home.html)
有什么想法吗?
谢谢
DD我试图做同样的事情,但遇到了同样的问题,最后使用了哈希。你有没有找到解决方法?