diff --git a/src/viewer.js b/src/viewer.js index 532f5078..95cfc908 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -174,7 +174,12 @@ $.Viewer = function( options ) { this.addHandler( 'open-failed', function (source, args) { var msg = $.getString( "Errors.Open-Failed", args.source, args.message); - window.alert( msg ); + + var errorDiv = $.makeNeutralElement( "div" ); + $.addClass( errorDiv, "modal-dialog error" ); + errorDiv.appendChild( document.createTextNode( msg ) ); + + _this.container.appendChild( $.makeCenteredNode(errorDiv) ); }); $.ControlDock.call( this, options ); @@ -423,6 +428,13 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, $TileSource, options; + if (this.container) { + var dialogs = this.container.querySelectorAll(".modal-dialog"); + for (var i = 0; i < dialogs.length; i++) { + dialogs[i].parentNode.remove(dialogs[i]); + } + } + //allow plain xml strings or json strings to be parsed here if( $.type( tileSource ) == 'string' ){ if( tileSource.match(/\s*<.*/) ){