2015-02-06 75 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

回答

相關問題