Topic: baseurl and mobile gallery version

Hello again,

Now it's time to run my galeries on mobile :-)

I have another problem, my photos are in domain.com/photos/gallery_name/
svcore is domain.com/svcore

and mobile version of site is m.domain.com

at m.domain.com I have folders:

gallery_name_1
gallery_name_2
gallery_name_3

inside each is index.html


<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
<html>
<head>
    <meta http-equiv='content-type' content='text/html; charset=utf-8'>
    <title>gallery_x_title</title>
</head>

<body>
    <script type='text/javascript' src='http://domain.com/svcore/js/simpleviewer.js'></script>
    <script type='text/javascript'>
    var flashvars = {};
    flashvars.baseURL = 'http://domain.com/photos/gallery_name/';
    simpleviewer.ready(function () {
        simpleviewer.load('sv-container', '100%', '100%', '222222', true, flashvars);
    });
    </script>
    <div id='sv-container'></div>
</body>
</html>

and this code works great from desktop browser, but from mobile device (where flash isn't installed) I have "gallery xml not found' error, probably non-flash version don't use flashvars.baseURL?

Any fix?

Last edited by YaPKnn (2014-02-04 22:17:12)

Re: baseurl and mobile gallery version

I tried also:

<body>
    <script type='text/javascript' src='http://domain.com/svcore/js/simpleviewer.js'></script>
    <script type='text/javascript'>
    simpleviewer.ready(function () {
        simpleviewer.load('sv-container', '100%', '100%', '222222', false, {galleryURL: 'http://domain.com/photos/gallery name/gallery.xml'});
    });
    </script>
    <div id='sv-container'></div>
</body>

still no success :-(

Re: baseurl and mobile gallery version

First of all, please make sure that you are using the current version of SimpleViewer-Pro (v2.3.1) to ensure that any bugs that were present in previous versions but which have since been fixed are not contributing to your problem.
If necessary, instructions for upgrading SimpleViewer-Pro can be found here.

The problem is likely to be that you hard-code 'domain.com' into the paths in your gallery's embedding code, but your mobile site uses the 'm.domain.com' subdirectory. For the Mobile Player to function correctly, all the gallery files must be on the same domain or subdomain as the web page containing the gallery's JavaScript embedding code. This is due to the same-origin policy. Use relative paths (rather than absolute paths) within your gallery's embedding code and all should be well.

Try the following:

<script type='text/javascript' src='/svcore/js/simpleviewer.js'></script>
<script type='text/javascript'>
    var flashvars = {};
    flashvars.baseURL = '/photos/gallery_name/';
    simpleviewer.ready(function () {
        simpleviewer.load('sv-container', '100%', '100%', '222222', true, flashvars);
    });
</script>
<div id='sv-container'></div>
Steven Speirs
SimpleViewer Support Team.

Re: baseurl and mobile gallery version

Thanks, Now I understand, I didn't know about same-origin policy.

Probably I'll move galleries to my /m folder, so my top domain can read from /m folder because it subfolder of public_html, and sub-domain will can read galleries also. Thanks.

Last edited by YaPKnn (2014-02-05 00:47:10)