history.js plugin - how to use

2020-03-06 07:33发布

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

3条回答
Anthone
2楼-- · 2020-03-06 08:05

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...

查看更多
做个烂人
3楼-- · 2020-03-06 08:09

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...

查看更多
【Aperson】
4楼-- · 2020-03-06 08:13

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.

查看更多
登录 后发表回答