웹사이트에서 인쇄를 비활성화하는 방법
                                            
                                                
                                                
                                                
                                                
                                                
                                                 6416 단어  javascriptcssprivacywebdev
                    
<script>
    //Prevents Ctrl + P
    //From https://stackoverflow.com/a/47848090/1928691
    window.addEventListener('keydown', function(event) {
        if (event.keyCode === 80 && (event.ctrlKey || event.metaKey) && !event.altKey && (!event.shiftKey || window.chrome || window.opera)) {
            event.preventDefault();
            if (event.stopImmediatePropagation) {
                event.stopImmediatePropagation();
            } else {
                event.stopPropagation();
            }
            return;
            }
    }, true);
    //Disables text selection and copying
    //From https://gist.github.com/pbaruns/a24ad79b027956ed5d77fd3e6c201467
    if (typeof document.onselectstart != "undefined") { 
        document.onselectstart = new Function ("return false");
    } 
    else { 
        document.onmousedown = new Function("return false"); 
        document.onmouseup = new Function("return true");
    }
</script>
<style>
    /*From https://stackoverflow.com/a/3359980/1928691*/
    @media print {
        html, body {
            display: none;  /* hide whole page */
        }
    }
</style>
완벽합니까? 물론 그렇지 않습니다.
이는 귀하의 여정을 지원할 수 있는 빠른 솔루션일 뿐입니다.
나를 팔로우하세요:
링크드인
유튜브
인스 타 그램
사이버 예언자
당신의 이야기를 공유



 
                Reference
이 문제에 관하여(웹사이트에서 인쇄를 비활성화하는 방법), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/fanmixco/how-to-disable-printing-in-a-website-591n텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)