If you do not want to use a query string (or a #) to pass a parameter via a URL, then I'm not exactly sure how you want to pass a parameter to the script (intended to avoid using inline JavaScript) without actually using inline JavaScript to pass the parameter.
You could perhaps set a session cookie (and grab the cookie's contents from within the script) but then you'd probably need separate scripts (to avoid using inline JavaScript) to set the cookie's functions and to set the cookie's contents (and it all seems to be overcomplicating matters somewhat).
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Juicebox-Pro Gallery</title>
<script src="jbcore/juicebox.js"></script>
<script src="cookie.js"></script>
<script src="create_cookie.js"></script>
<script src="script.js"></script>
</head>
<body>
<div id="juicebox-container"></div>
</body>
</html>
'cookie.js':
function createCookie(name, value) {
document.cookie = name + '=' + escape(value) + '; path=/';
}
function readCookie(name) {
var re = new RegExp('(?:^|;)\\s?' + name + '=(.*?)(?:;|$)', 'i'), result = document.cookie.match(re), output = null;
if (result != null) {
output = unescape(result[1]);
}
return output;
}
function eraseCookie(name) {
var d = new Date();
document.cookie = name + '=; path=/; expires=' + d.toUTCString();
}
'create_cookie.js':
createCookie('base', '/galleries/gallery_1/');
'script.js':
var base = readCookie('base');
eraseCookie('base');
new juicebox({
baseUrl: base,
containerId: 'juicebox-container'
});
I guess this might not help as it still leaves us with the problem of how to get the parameter into the 'create_cookie.js' script without using inline JavaScript. It just shifts the problem around a bit (and avoids using a query string).
I do not know how (or where) your baseUrl and shareUrl parameters are being generated but if they are already being generated in another external script, then maybe you could just set the cookie directly from within this script (and it could still be read from the 'script.js' file above).
If you just want to set a global JavaScript variable for your parameter, then the problem still exists (at least in my own understanding) of how to set it without using inline JavaScript. I guess I really need to know how and where your baseUrl and shareUrl parameters are being generated so if you could please elaborate on that, then it might help me to try to formulate a solution.
Thank you.
I hope this helps (or at least gives you a little more food for thought).