Пятница, 28 Июн 2019 в 11:46

Защита от копирования содержимого страницы

Автор: admin

Интересный код, для полной защиты от копирования в разных браузерах. Вставить в шапку 🙂


<script type="text/javascript">
	function clickExplorer() {
		if( document.all ) {
			//alert('Stop copying the copyrighted material!');
		}
		return false;
	}
	function clickOther(e) {
		if( document.layers || ( document.getElementById && !document.all ) ) {
			if ( e.which == 2 || e.which == 3 ) {
				//alert('Stop copying the copyrighted material!');
				return false;
			}
		}
	}
	if( document.layers ) {
		document.captureEvents( Event.MOUSEDOWN );
		document.onmousedown=clickOther;
	}
	else {
		document.onmouseup = clickOther;
		document.oncontextmenu = clickExplorer;
	}
</script>

<script type="text/javascript">
	function disableSelection(target){
	if (typeof target.onselectstart!="undefined") // IE
		target.onselectstart=function(){return false}
	else if (typeof target.style.MozUserSelect!="undefined") // Firefox
		target.style.MozUserSelect="none"
	else // Opera etc
		target.onmousedown=function(){return false}
	target.style.cursor = "default"
	}
</script>

<script type="text/javascript">
	/* <![CDATA[ */
		window.addEvent('domready', function() {
			document.body.oncopy = function() {
				//alert('Stop copying the copyrighted material!');
				return false;
			}
		});
	/* ]]> */
</script>

Ваш отзыв

Цитаты великих

"Жизнь долга, если она полна. Будем измерять ее поступками, а не временем."

Сенека Младший

Я в Контакте