Skip to content

JAIPHO 0.52 - Javascript history patch

July 24, 2009 by Tole

There is bug in Safari browsers while interpreting javascript document.location.replace() method. Instead of just replacing the loaction, it also appends history. Result is that after you navigated in Jaipho through slides, pressing Back in browser will return you through slides back (still in Jaipho), instead returning you to original page you came from (gallery list, news article ...). Several users contacted me regarding this annoying behavior.
This version offers patch for this problem.

Jaipho changes
History patch. Introduced new configuration parameter ENABLE_SAFARI_HISTORY_PATCH which by default workarounds this problem. One feature is lost when applying this patch: now the url in location bar does not changes as you navigate through Jaipho slides, so you can not send or add as favorite, direct link to particular slide.

Large galleries patch (over 5 MB in total images size). There is limitation in iPhone Safari browser in caching loaded images. After 5 MB of loaded images (approx 100 iPhone optimized jpg-s), it just doesn't load new images anymore. No error is reported, all is working just OK, but new images are not shown. This version fixes it behavior, so when you broke that limit, it will destroy last used images and load new. As there is no way to detect when the cache is full, I added new configuration parameter which will set how many images can be preloaded in total SLIDE_MAX_IMAGE_ELEMENS. By default is set to 50.

Lost touch events bugfix. It apply only if you are using Jaipho in old history mode (ENABLE_SAFARI_HISTORY_PATCH = false). If you were pressing Back in browser, Jaipho has lost ability to detect Touch events until you reloaded page. Now this is fixed.

Upgrade instruction
Upload new javascript source file on your server (jaipho-0.52.00.zip).
After that, you should change some values in your template file.
Change the src attribute of script tag, to point at that new uploaded source file.
In javascript block add these configuration lines:
var ENABLE_SAFARI_HISTORY_PATCH = false;
var SLIDE_MAX_IMAGE_ELEMENS = 50;