1 (edited by jeroenb42 2017-01-02 16:12:11)

Topic: Fix for 3G/4G problems content modification [SOLVED]

I am very happy with Juicebox but was annoyed by the fact that it does not work on a mobile device if you are 'on the road', using your 3G/4G connection and the provider messing up the javascript. I found a solution which I thought I should share here.

My solution assumes that your webserver has PHP running.

What you need to do is the following 4 things:

1. change your main page and add the following 3 lines at the very top:

<?php
header("Cache-Control: no-transform");
?>

2. change the reference to the Juicebox javascript to:

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

3. change the juicebox.js file and add the extension .php so that it's name is juicebox.js.php

4. change the juicebox.js.php file (I used Notepad++ to change it but I suppose any text editor should be able to do it) and add the following 3 lines at the very top:

<?php
header("Cache-Control: no-transform");
?>

I know it's a (slight) modification of the Juicebox scripts which will break with every update but the upside is that your site will also work with Juicebox when your customers are on a mobile network.

Disclaimer :-) I was only able to test with Vodafone but the trick should work with all providers.

Re: Fix for 3G/4G problems content modification [SOLVED]

Content modification is a known issue which can affect a lot of JavaScript code (not just Juicebox).
The issue (and its solution) can be found in the following FAQ:
Why can't I view my gallery on a 3G mobile connection?

Incidentally, if you set the 'no-transform' cache-control header in an .htaccess file (as noted in the FAQ above), then there should be no need to modify the 'juicebox.js' file (or its path) and no need for PHP to be installed on the server.
I hope this helps. (It should save you from having to make your modification to all galleries individually.)

Re: Fix for 3G/4G problems content modification [SOLVED]

The .htaccess change only works if you have a server that works with those files and unfortunately on my Synology this did not work. This solution however does.

I did read the FAQ but since that solution did not work for me, I tried this and this works for me and that's why I thought I should share it. :)

Re: Fix for 3G/4G problems content modification [SOLVED]

The FAQ has a solution for Apache servers and a link to a similar solution for IIS servers.
Your solution should certainly work for all others. Thanks for sharing!