[英]android browser location bar doesn't update for fragment change
這看起來很瘋狂。 我肯定錯過了什么。 在Android瀏覽器(ICS,4.0.3)中設置位置片段時,位置欄無法更新以顯示新片段。 無論設置window.location
, window.location.hash
還是普通的<a href="#foo">
,似乎都同樣失敗。 瀏覽器確實確實導航到所需的片段,並且在刷新時,位置欄包含預期的片段。 后退按鈕有效! 唯一的錯誤是,位置欄中顯示的地址應立即反映新的位置+片段,但不能。
在Google Closure goog.History演示頁上可以看到一個很好的例子。
我們在Android 4.0.4中也注意到了這一點。
更糟糕的是,如果url僅包含路徑(例如http://www.example.com/path/
),則至少在一個設備(Galaxy Nexus)上,哈希導航會中斷。 然后,您可以導航到片段URL很好,但是點擊“后退”按鈕無效 。
當URL中存在文件時,此問題已解決。
# will fail when using browser back button
www.example.com/path/
# will work although no fragment is shown
www.example.com/path/index.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.