Topic: How to get Version of SV using JS API?


I use SV for a lot of web-projects since 2011 and I'm really satisfied with it.
In my current project I wanted to distinguish between the PRO and the LITE version.

Is it possible to get any version informations using the Javascript API?
It would be great if SV would return something like "SimpleViewer PRO v2.3.2"...


Re: How to get Version of SV using JS API?

Unfortunately, the SimpleViewer-Pro API does not contain a method to get the version number.
You could perhaps manually code some JavaScript to extract the relevant information from the comments at the top of the 'svcore/js/simpleviewer.js' file. (Read and return the second line of the file, stripping out everything before the word 'SimpleViewer'.)

Here is a JavaScript function which you might be able to use/adapt to your own needs.

function getVersion(file) {

    var xmlhttp;

    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest(); // Code for Chrome, Firefox, Internet Explorer > 6, Opera and Safari
    } else {
        xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); // Code for Internet Explorer 5 and Internet Explorer 6

    var result;

    if (xmlhttp !== null) {'GET', file, false);
        var text = xmlhttp.responseText; // Complete text of file
        var lines = text.split('\n'); // Split text into lines using line feed as separator
        var line = lines[1]; // Second line of text containing version
        var index = line.indexOf('SimpleViewer'); // Start of 'SimpleViewer' text
        var len = line.length; // Length of second line of text
        result = line.substring(index, len); // Second line of text starting at 'SimpleViewer'
        var pro = line.indexOf('Pro'); // Start of 'Pro' text
        if (pro === -1) {
            result = result.replace('SimpleViewer', 'SimpleViewer-Standard'); // If not Pro, change 'SimpleViewer' to 'SimpleViewer-Standard'

    return result;


var version = getVersion('svcore/js/simpleviewer.js');

Steven Speirs
SimpleViewer Support Team.