Re: Home Button gets hidden and replaced by an X on Apple's iPads

I'm so sorry... I've just noticed there was a small but crucial error in the code I provided which might be causing some confusion.
I've corrected it in my post above (in case anyone copies it in the future).
The correct line of code should be:

var customPosition = isIPad() ? 'CENTER' : 'LEFT';

(Note the two brackets after 'isIPad'.)

I guess I was playing around with functions and variables before I decided on what to post and I ended up with a mismatch.
Anyway, if you change the line above, you'll find that the Back Button is centred only on iPads. On other devices (including desktops), the Back Button will be positioned to the left.

A couple of other notes which might help to clarify some things...

... and Apple's Horrible X has been obliterated!

The cross should not appear if you set fullScreenExpand="FALSE". If fullscreenExpand="TRUE", then the cross should appear, no matter what other configuration options are used.

However, the trade-off on a large-screen computer is that the images in a Gallery will no longer fill the Browser window (as you will see that they do in the original link to "Lemurs, Bronx Zoo" on the Landing-page.

I see no difference in the size of the images between your Bronx_Zoo and Bronx_Zoo-TESTING galleries (tested in a desktop browser).
Other than the position of the Back Button (which should be the same in both galleries after you change the code above), they seem identical to me.

It is probably not possible to further refine the Script to say, in effect:
"Ignore the Script unless the User is using Mobile Safari on a newer iPad" ?!!

It's possible to specifically target more recent versions of iOS but there seems to be no easy way to determine the version of iOS other than parsing the user agent string and there are many ways to do this.
There are several different examples on these pages:
https://stackoverflow.com/questions/757 … e/13549283
https://stackoverflow.com/questions/834 … javascript

I'm not sure in which version of iOS the fullscreen exit button was introduced but here's some code which should center the Back Button only on iPads running iOS 12 or greater you can change this version number in the code if you need to), with the Back Button positioned left in all other cases.

<script src="jbcore/juicebox.js"></script>
<script>

    function isIPad() {
        var agent = window.navigator.userAgent;
        return /iPad/i.test(agent);
    }

    function iOSVersion() {
        var agent = window.navigator.userAgent;
        var start = agent.indexOf('OS ');
        if (/iP(ad|hone|od)/i.test(agent) && start > -1) {
            var match = agent.match(/OS (\d+)_(\d+)_?(\d+)?/);
            var version = [parseInt(match[1], 10), parseInt(match[2], 10)];
            return parseFloat(version.join('.'));
        }
        return false;
    }

    var customPosition = isIPad() && iOSVersion() >= 12 ? 'CENTER' : 'LEFT';

    new juicebox({
        containerId: "juicebox-container",
        galleryWidth: "100%",
        galleryHeight: "100%",
        backgroundColor: "rgba(204,204,204,1)",
        backButtonHAlign: customPosition
    });

</script>

You could do likewise with the useFullscreenExpand configuration option (using the Fullscreen API on all devices except the iPad) if you like.

<script src="jbcore/juicebox.js"></script>
<script>

    function isIPad() {
        var agent = window.navigator.userAgent;
        return /iPad/i.test(agent);
    }

    function iOSVersion() {
        var agent = window.navigator.userAgent;
        var start = agent.indexOf('OS ');
        if (/iP(ad|hone|od)/i.test(agent) && start > -1) {
            var match = agent.match(/OS (\d+)_(\d+)_?(\d+)?/);
            var version = [parseInt(match[1], 10), parseInt(match[2], 10)];
            return parseFloat(version.join('.'));
        }
        return false;
    }

    var fullscreen= isIPad() && iOSVersion() >= 12 ? 'FALSE' : 'TRUE';

    new juicebox({
        containerId: "juicebox-container",
        galleryWidth: "100%",
        galleryHeight: "100%",
        backgroundColor: "rgba(204,204,204,1)",
        useFullscreenExpand: fullscreen
    });

</script>

I hope this helps.

27

Re: Home Button gets hidden and replaced by an X on Apple's iPads

Steven:

Your clue about inserting fullScreenExpand="FALSE" was the magic bullet!

As a result, I seem to have got the Galleries to behave in the way that I wanted.

Home/Back Button is positioned Top and Left;
and
fullScreenExpand="FALSE" is now inserted automatically into the Config file;

That combination prevents Apple's "X" from appearing on an iPad;
and it also keeps the Juicebox icon for the Back Button at the top and left of the screen.

I have saved a new Custom Preset (which incorporates that change in coding) and the following is a portion of the .xml coding in that Preset:

<?xml version="1.0" encoding=w"UTF-8"?>

<juiceboxpreset showNavButtons="true"
    showAutoPlayButton="true"
    backButtonPosition="TOP"
    backButtonUseIcon="true"
    backButtonHAlign="LEFT"
    useFullscreenExpand="false"
    backButtonUrl="https://shelbourne-america.net"
    galleryTitlePosition="ABOVE_THUMBS"
    maxThumbColumns="48"
    galleryFontFace="Verdana"
    showSmallThumbNav="true"
    galleryTitleHAlign="CENTER"
    frameWidth="2"
    showImageOverlay="ALWAYS"
    imageNavPosition="STAGE"
    showEmailButton="true"
    buttonBarPosition="TOP"

etc., etc..

I can e-mail the full customised Preset to you if you would like me to.

As it turns out, there is no need to change the html in the Gallery's Index file at all;
just inserting this simple extra line of "useFullscreenExpand="false"" into the .XML code in a Custom Preset does exactly what I needed.

If you check the Galleries listed in the top three rows on my web site on a newish iPad you should see that Apple's X has gone and the Home Button is positioned on the Left and it now returns a visitor to my web site's landing (Home) page.

I can now apply my new Preset to each of the JB Galleries on my site; quickly reset details for Gallery Name and Splash Screen; Save and re-load them to the Server.

Your help has been really valuable so thank you!

Ann

Re: Home Button gets hidden and replaced by an X on Apple's iPads

You're welcome!

I'm really glad that you've found a solution that you're happy with.
Thank you for letting me know.

Just for clarification, it looks like Apple introduced Fullscreen API support (including the 'Exit Fullscreen' button) on the iPad in iOS 12 so, if you wanted to do a conditional check on the version of iOS being run, then iOS 12 or later is what you'd be looking for.

Here's a quote from Apple's Safari 12 Release Notes page:

Added support for viewing HTML elements in full screen on iPad.

29

Re: Home Button gets hidden and replaced by an X on Apple's iPads

That would explain it!

If Apple introduced Fullscreen API support (including the 'Exit Fullscreen' button) on the iPad in iOS 12 that would explain why I only became aware of the issue recently when I looked at my own web site on my new iPad because my old iPad (which I sent back to Apple for recycling) was on iOS 11.

Their X Exit Button makes any web site that uses a Landing/Home page linked to various JuiceBox Galleries unusable by the visitor because they will have enormous difficulty escaping from the Gallery's Splash Screen and returning to the Home Page Index.

I am so glad that I discovered this and am now able to fix it  — thanks entirely to your enormous help!

It might be a good idea if you alerted your other Customers to this issue; and perhaps provided some new downloadable Presets to address this problem?

30

Re: Home Button gets hidden and replaced by an X on Apple's iPads

One other thing that i came across is that Adobe Dreamweaver is showing an Error on Line 14 of the JB Javascript.

This may be something which you would want to fix?

The attached Screen shot shows where the problem lies but the image is rather small (it's reduced to 50% size in order to fit the forum size-requirements) so I hope that you can read it.

Post's attachments

Screen Shot 2021-07-27 at 12.32.08 PM.png 1.64 mb, file has never been downloaded. 

You don't have the permssions to download the attachments of this post.

Re: Home Button gets hidden and replaced by an X on Apple's iPads

It might be a good idea if you alerted your other Customers to this issue; and perhaps provided some new downloadable Presets to address this problem?

It's certainly something for the developers to think about (I don't make design decisions around these parts), although the workarounds are simply to set either backButtonHAlign="CENTER" or useFullScreenExpand="FALSE" which are easy enough to implement.
Other more complex solutions, such as settings one of these configuration options conditionally (e.g. only in Mobile Safari on iPads running iOS 12 or later) can only be achieved through JavaScript and not simply through use of a preset.

Also, some people might actually like Apple's 'Exit Fullscreen' button! There are plenty of people on the internet who are vocal about it and want to try to disable it but it's probably only those who do not like it that have reason to post. Those that like the 'Exit Fullscreen' button are perhaps a silent majority.

In any case, this forum thread serves as a reminder of what can be done to work around the issue.
There should be enough keywords within this thread that anyone searching for the issue will end up here.

One other thing that i came across is that Adobe Dreamweaver is showing an Error on Line 14 of the JB Javascript.

The error that Dreamweaver reports is nothing to worry about.
An unnecessary semi-colon at the end of a line of JavaScript code will simply be ignored by browsers and is not a functional problem.
Also, it looks like the semicolon in question is actually being introduced by the packer we use to compile the JavaScript source code. (The semi-colon is not in our source code.)
The semicolon (line 14, column 246) comes after the closing '}' character of an 'if' block and immediately before the start of a 'while' loop.
If you enter any JavaScript code at all (e.g. var a;) into this online packer,, select the 'Base62 encode' checkbox and click the 'Pack' button, you'll see exactly the same thing (although at a different column number) in the packed output code.

So, essentially, it's nothing to worry about and nothing that we can do anything about unless we change our JavaScript packer (and one extra benign semicolon is perhaps not reason enough to change).

Thank you for reporting it, though. If it was a functional problem, we'd most certainly want to know.