diff --git a/WebContent/jsp/onl/transaction/tracking/trackingManDetail.jsp b/WebContent/jsp/onl/transaction/tracking/trackingManDetail.jsp index 5578624..18e3d05 100644 --- a/WebContent/jsp/onl/transaction/tracking/trackingManDetail.jsp +++ b/WebContent/jsp/onl/transaction/tracking/trackingManDetail.jsp @@ -802,6 +802,35 @@ $(document).ready(function() { $("html, hbody").css("overflow-x","scroll"); } + function copyTextToClipboard(text, successMessage){ + if (typeof(navigator.clipboard) == 'undefined'){ + var textArea = document.createElement("textarea"); + textArea.value = text; + textArea.style.position = "fixed"; + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + var successful = false; + try{ + successful = document.execCommand('copy'); + }catch(err){ + + } + document.body.removeChild(textArea); + if (successful){ + alert(successMessage); + }else{ + prompt("Ctrl+C 를 눌러 클립보드로 복사하세요.", text); + } + }else{ + navigator.clipboard.writeText(text).then(function(){ + alert(successMessage); + }).catch(function(){ + prompt("클립보드 복사에 실패했습니다. Ctrl+C 를 눌러 복사하세요.", text); + }); + } + } + $('#headerToClipboard').click(function(){ if($('#grid1').get(0) == null || $('#grid1').get(0).jexcel == null){ return; @@ -813,13 +842,11 @@ $(document).ready(function() { paddedValues += row[5].padEnd(row[4], " "); } - navigator.clipboard.writeText(paddedValues);//클립보드로 복사 - alert('헤더값이 복사되었습니다.') + copyTextToClipboard(paddedValues, '헤더값이 복사되었습니다.'); }); $('#messageToClipboard').click(function() { - navigator.clipboard.writeText(fullMessageData);//클립보드로 복사 - alert('전체 전문 복사되었습니다.') + copyTextToClipboard(fullMessageData, '전체 전문 복사되었습니다.'); }); $('#btn_pretty_print').click(function () {