0
我有一個AJAX Web應用程序,我希望URL能夠反映當前查詢的內容,以便擁有「固定鏈接」。例如,用戶在搜索輸入中輸入「foobar」作爲查詢,則URL欄中的http://example/search/
變爲更新爲http://example/search/?foobar
。使用當前查詢的網址
當試圖與index.html作爲實現這一點:
<script>
query = "foobar";
window.location.search = query;
</script>
首先這個奇怪的將無限循環瀏覽器。我錯過了什麼?
相關問題:https://github.com/kaihendry/Greptweet/issues/20#issuecomment-7875290 – hendry 2012-08-20 17:12:20
您沒有給我們足夠的代碼繼續。設置window.location.search將總是重新加載頁面,所以如果你在頁面加載時設置它,它會循環。 – 2012-08-21 09:32:24