Rewrite url ala Google Instant?

自古美人都是妖i 提交于 2019-12-25 14:45:13

问题


I have a e-commerce website built in Ajax and Js, when the user type a search keyword the list is pulled via ajax but the browser url, in my case doesn't change, so if the user reaload or simply bookmarks the address he 'll have to start form scratch loosing the keywords input.

i noticed Google instead rewrites the url with the complete query, no hashtag or complex workaround...apparently

how can i achieve that? consider i have complete control on my server so i can set my apache in any way i want.

thanks!!


回答1:


I'm not sure what browser you're using, but I get all the search terms after a hashtag in Chrome (e.g., http://www.google.com/#sclient=psy&hl=en&q=test+test+sibilance&aq=3&...). I don't think what you think is occurring is actually happening. It could be done on Chrome and other HTML5 browsers using history.pushState(), but I don't see Google Instant using that method.




回答2:


See this question, almost the same except they used Facebook as a example.

  • How does facebook rewrite the source URL of a page in the browser address bar?



回答3:


If you watch the URL in Google Instant, it doesn't change until you hit "Search" or pause for a set period of time (2 seconds, i think).

After this delay, Google refreshes the page with those search queries.




回答4:


Then it is not instant. Without reloading the page you can only change the fragment identifier in the URL.




回答5:


My experience is, that after you changed the search, the Google URL is no longer "correct", i.e. it does not represent the latest query.



来源:https://stackoverflow.com/questions/4125706/rewrite-url-ala-google-instant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!