Thanks for the support.

The point is that even if you set firstImageIndex to the right index, juiceebox do not show the correct image if showSplashPage is not  set to "NEVER".
The correct image is shown after you tap the image (then full html is loaded and show the correct image)

So # in the URL as well as the firstImageIndex do not work on mobile devices if splash page is activated :(

Thanks for this great help!

Indeed, setting showSplashPage="NEVER" and showSmallThumbsOnLoad="FALSE" solved the problem. When I enter a url with #<number> on iOS / safari, the proper image is shown. Thanks for that!

Sadly this does not work when I share an image on FB.

The open graph tags are set correctly:

  • og:url points to the gallery including my “Img” parameter and the correct # number

  • og:image points directly to the jpeg

The facebook preview and posting are correct. When I click on the FB post on iOS, the gallery shows the first image but not the correct one. The gallery page is shown in a safari control that is embedded in the FB app. If I hit “open in safari” or “share / copy link” and paste the url in a native safari, the correct image is shown.

No idea what is going on here. Safari behaves different when embedded in the FB app.
Now we are far away from juicebox :) Any idea?

Back to your thought: Do you have an example how to set the firstImageIndex configuration option via JS?
The lack of the splash page on small devices is really frustrating. I'm looking for another solution.

Hi Steven, hi all.

Thanks for the answer. Finally I got it to work but having some caveats on iOS that I'd like to share with you and asking for solutions.

The problem when sharing images on Facebook using the image number like http://xyz/mygallery/#5 is that juicebox do not deliver open graph tags (go:url, go:title, ...) for the shared image but for the whole gallery. Because Facebook requires proper set open graph tags, the image can't be shared. The image preview and description does not match the actual image.

The reason for this behavior is simple and easy to follow from the perspective of juicebox: The http selector (#) is evaluated in the user agent via javascript, while the open graph tags are rendered by a static HTML page before javascript is evaluated. It is not easy (I think impossible) to adjust the open graph tags via javascript in a way that Facebook will go fine with it.

My Solution: In cases where I like to have an external link for Facebook, Twitter or somewhat that requires proper set open graph tags, I'm using a different url layout: http://xyz/mygallery/index.php?Img=images%2Fmyimage5.jpg#5. The Img parameter can be evaluated on server side and a proper site with correct open graph tags can be rendered. The # can't be used for that because it isn't passed to the server. For a convenient usage of juicebox, I've overriden the javascript twitter, Facebook, .. handlers. When clicking the Facebook share icon in my gallery, the correct Facebook share URL including the Img parameter is generated. The image name is taken from the config.xml that gets parsed via javascript. On server side there is a index.php file that parses the config.xml file too. It renders the open graph tags dynamically and adds the image title, description and so on to the page. If you reorder or add additional images to the gallery, the image numbers will change. For that case the php script ensures the appropriate image number is used in url by modifying the url. The script ensures that the leading image selector is the Img parameter and not the # http selector.

It took me some hours to getting all these things to run. Finally it works really nice. For those who like to see that in action, can check my private website http://www.sk-sly.de

Now the caveat that seems to be a general problem that has nothing in common with my solution.
URL selectors (#) and juicebox seem not to work on iOS with safari! When entering a url on iOS http://abc..../gallery/#5 always the first image is shown but not the 5th. Please try it with you galleries. It seems that the selector is not evaluated by safari on iOS or something strange inside of the juicebox javascript code happens. On OS X with safari or other browsers everything works properly.

Does anyone know something about this issue? Is this a Safari problem on iOS or is the juicebox code broken here?

A solution for this caveat could be for me to initialize the juicebox java script by a code block that is rendered by my php script. In know on server side exactly which image has to be shown. The problem with that is that the jukebox code is obfuscated and I don't have any idea which variable I could modify to achieve this behavior. Any idea about that?

In general I think that it wasn't the best decision of the juicebox developers to use a http selector (#) as image selector. The selector isn't passed to the server and open graph tags can't be rendered properly. We are running into problems with iOS. Links are not stable because the image order could change by resorting or inserting new images.

Regards!
Sly

Was this feature possibility added in the mean time?
The post is 4 years old now.

I'd like to have direct links to an image inside a jukebox gallery. For example to link the image from facebook.
What is the solution for this?