Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / docs: Use javascript to avoid page reloads
- - By Günther [de] Date 2012-01-11 22:52
<JCaesar> Eh, why is the doc index an iframe and not the content? The other way around you would save quite some data reloading plus you'd keep the scroll position.
<JCaesar> :/
<Guenther> JCaesar: So that you can easily copy the URL
<JCaesar> Hm, okay.
<Guenther> Feel free to add some javascript to replace the reloading with AJAX and history API
<JCaesar> Nah. I#ve already done stuff like that for own pages. It's a pain.

Turns out, it only takes about 29 lines of Javascript for a basic implementation. Also supporting the inpage-links would take a bit more, but not much. This shouldn't change anything in browsers not supporting the history.pushState API, but I've only tested it in Firefox 12 and I don't whether and how interoperable other browsers implemented that API.
Attachment: 0001-docs-Use-javascript-to-avoid-page-reloads-when-using.patch - docs: Use javascript to avoid page reloads when using the toc (4k)
Reply
Parent - - By Caesar [de] Date 2012-01-12 11:01
Stuff like
  if (window.XMLHttpRequest)
    return new XMLHttpRequest();
  else if(window.ActiveXObject)
    return new ActiveXObject("Microsoft.XMLHTTP");

finally got unnecessary?
Parent - By B_E [de] Date 2012-01-12 15:55
Yes, except for the old IE6-users obviously.
Parent - - By Luchs [de] Date 2012-01-12 18:55
IE does not support pushState, so no point in testing that.
Parent - - By ST-DDT [de] Date 2012-01-12 19:42
btw who uses IE6?
this is a security risk, because you can push an elephant through the gaps without noticing.

and a lot of webservices have sentences like "Any older version might not work. The solution is to UPGRADE!"
Parent - - By Newton [de] Date 2012-01-12 20:02
Who is talking about IE6?
Parent - - By ST-DDT [de] Date 2012-01-12 21:26

>Yes, except for the old IE6-users obviously.


B_E did
Parent - By Luchs [de] Date 2012-01-13 00:17
You should click the "Reply" button on B_E's post then, not on mine.
Parent - - By B_E [de] Date 2012-01-12 20:28 Edited 2012-01-12 20:31
IE actually does, as of version 10 (http://blogs.msdn.com/b/ie/archive/2011/10/31/html5-history-in-ie10.aspx).

Edit: You could btw usally just emulate this behaviour with the hashsign-appendix.
Parent - By Günther [de] Date 2012-01-12 21:24

> IE actually does, as of version 10


Which also supports new XMLHttpRequest.

> You could btw usally just emulate this behaviour with the hashsign-appendix.


We're already using those for their intended purpose, and I'd like to keep the URLs and page-load times when navigating to them from elsewhere short.
Reply
Parent - By Luchs [de] Date 2012-01-13 00:16

>version 10


...which will be released later this year. There isn't even a build that doesn't require Windows 8 yet.
Up Topic Development / Developer's Corner / docs: Use javascript to avoid page reloads

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill