// -------------------------------------------------------------------- function copyToClipboard( val ) { // IE-specific code path to prevent textarea being shown while dialog is visible if ( window.clipboardData && window.clipboardData.setData ) { clipboardData.setData( "Text", val ) ; return ; } if ( document.queryCommandSupported && document.queryCommandSupported("copy") ) { // create a textarea to hold the content var textarea = document.createElement( "textarea" ) ; textarea.style.position = "fixed" ; // prevent scrolling to bottom in MS Edge document.body.appendChild( textarea ) ; textarea.textContent = val ; // copy the textarea content to the clipboard textarea.select() ; try { document.execCommand( "copy" ) ; if ( getUrlParam("log-clipboard") ) console.log( "CLIPBOARD:", val ) ; } catch( ex ) { showErrorMsg( "Can't copy to the clipboard: