diff --git a/src/tilesource.js b/src/tilesource.js index d8c16803..26c220b7 100644 --- a/src/tilesource.js +++ b/src/tilesource.js @@ -649,7 +649,11 @@ function processResponse( xhr ){ data = xhr.responseText; } }else if( responseText.match(/\s*[\{\[].*/) ){ - data = $.parseJSON(responseText); + try{ + data = $.parseJSON(responseText); + } catch(e){ + data = responseText; + } }else{ data = responseText; } diff --git a/src/viewer.js b/src/viewer.js index a3a09828..17120ae1 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -2136,6 +2136,7 @@ function _getSafeElemSize (oElement) { ); } + /** * @function * @private @@ -2151,7 +2152,12 @@ function getTileSourceImplementation( viewer, tileSource, imgOptions, successCal tileSource = $.parseXml( tileSource ); //json should start with "{" or "[" and end with "}" or "]" } else if ( tileSource.match(/^\s*[\{\[].*[\}\]]\s*$/ ) ) { - tileSource = $.parseJSON(tileSource); + try { + var tileSourceJ = $.parseJSON(tileSource); + tileSource = tileSourceJ; + } catch (e) { + //tileSource = tileSource; + } } }