history.js plugin - how to use

夙愿已清 提交于 2019-12-19 04:23:37

问题


I need a hand with the history.js plugin.

I put together a brief page to test the functionality - http://www.salesmelbourne.com/

Currently I'm struggling with the following:

  1. Back/forward buttons don't reload the AJAX div - is this an extra history.js function that I haven't added or do I need to code this myself? or both.

  2. I notice when the title updates it flashes - I believe its briefly showing the page meta title. Can I make this smooth?

  3. IE (I'm using verison 9) shows a popup box on each page change saying 'message from the website' - kind of like an error - can I sort this somehow?

  4. Also under IE (HTML4 browser) I'm getting the 'suid=13383514298760299522541335484' etc. I don't see why I would need this - can I remove the suid?

thanks heaps


回答1:


To answer your questions: 1) Yes, you need to tie in history.js with your code. History.js will remember any parameters you pass to it, etc, but of course it's up to you to do something with those parameters.

2) Would need to see what you're referring to. My implementation doesn't "flash" the page, but then again, I'm not using the "title" functionality of history.js. See point #4 below for related info. I would bet your implementation is loading the page twice, each time you go back/forward.

3) I use IE9 and don't get any such alert. Provide more information about what it says. If it's an error message, then most likely you have a Javascript error in your code.

4) The suid param appears in non-HTML5 browsers (like IE9) when you use the data & title params of History.pushState(data, title, url). My implementation of history.js only uses the url param, therefore I do History.pushState(null, null, url) and the suid doesn't appear in IE9.




回答2:


3.IE (I'm using verison 9) shows a popup box on each page change saying 'message from the website' - kind of like an error - can I sort this somehow?

Reason: You need to remove 'History.log()' from the code... In IE this History.log is writing the log output in alertbox...




回答3:


history.js plugin doesn't work very well... its a good idea and I would still give the author credit for his attempts but almost none of the cased sites use it:

https://github.com/browserstate/history.js/wiki/Showcase

and the HTML4 support just gives me IE errors.

My advise if you looking for a solution like this is to write you own solution to suit the site you building...



来源:https://stackoverflow.com/questions/10809935/history-js-plugin-how-to-use

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