2015-02-06 70 views
2

而不是为我的SinglePageApplication使用散列URL我想使用HTML5浏览器历史记录API。到目前为止,这工作得很好(我使用emberjs)。使用HTML5浏览器历史API在SPA中进行页面刷新?

哈希URL的亲是,我可以刷新页面,而不用担心结果。当我尝试重新加载浏览器历史记录API时,我会得到一个404(因为我的服务器没有这个路由)。

因此:是否有避免此行为的常用解决方法?

我可以告诉我的服务器重定向到索引页面,但这不会显示正确的内容。

例子:

GET host/#images 
... shows the "images" page (even when it is the index.html) 

GET host/images 
... redirect to host/ 
... shows me the content of the index template 
+0

你可以添加你的'router.js'代码和你的'location':ie'hash'或'auto'http://emberjs.com/guides/routing/specifying-the-location-api/ – kiwiupover 2015-02-06 19:14:05

回答

相关问题