Topic: Getting gallery title via getGalleryInfo() object

Currently, the default browser window title of a SV gallery is "SimpleViewer-Pro Gallery".

I'm looking at a way to set the browser window title to be the same as the gallery title. Is there a way to get the gallery title via a property of the getGalleryInfo() object, or via another mechanism?

Basically, I'd like to call something like this, which would set the title after the gallery has finished loading:

<script type="text/javascript"> 
  function svComplete() {
    document.title = getGalleryInfo().title;
  }
</script>

Thanks for any suggestions!

Re: Getting gallery title via getGalleryInfo() object

How are you creating your gallery? There may be an easier way to set the browser window title to be the gallery title.
For example, JuiceboxBuilder-Pro and most SimpleViewer plugins already use the gallery title as the browser window title. Any methods that do not already do this may be able to be adapted by modifying the template used to create the gallery's XML file.

Unfortunately, there is no SimpleViewer-Pro API method which can be used to fetch the gallery title. getGalleryInfo() can be used to determine only imageCount (int), thumbPageCount (int) and thumbPageSize (int).

If you know what the filename and path of the gallery's XML file is going to be, then you could extract the 'title' attribute from the <simpleviewergallery> tag by parsing the XML file manually as follows:

var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET','gallery.xml', false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
document.title = xmlDoc.getElementsByTagName('simpleviewergallery')[0].getAttribute('title');
Steven Speirs
SimpleViewer Support Team.

Re: Getting gallery title via getGalleryInfo() object

Thanks, that worked after adding

flashvars.enableAPI = "true";

to my JS block.

Re: Getting gallery title via getGalleryInfo() object

Adding flashvars.enableAPI = "true"; should not be necessary.
The code I posted does not use the SimpleViewer-Pro API at all.
It is just regular JavaScript used to parse an XML file. (The fact that the XML file happens to store information for a SimpleViewer gallery is just incidental.)

Steven Speirs
SimpleViewer Support Team.