[팁] 웹사이트 콘텐츠 복사 제한하기
2015.09.15 17:24
152
0
https://eond.com/362685
object(HotopayModel)#862 (23) { ["error"]=> int(0) ["message"]=> string(7) "success" ["variables"]=> array(0) { } ["httpStatusCode"]=> int(200) ["module"]=> string(7) "hotopay" ["module_info"]=> NULL ["origin_module_info"]=> NULL ["module_config"]=> NULL ["module_path"]=> string(52) "/home/eond/web/eond.com/public_html/modules/hotopay/" ["xml_info"]=> NULL ["module_srl"]=> NULL ["mid"]=> NULL ["act"]=> NULL ["template_path"]=> NULL ["template_file"]=> NULL ["layout_path"]=> NULL ["layout_file"]=> NULL ["edited_layout_file"]=> NULL ["stop_proc"]=> bool(false) ["user"]=> object(Rhymix\Framework\Helpers\SessionHelper)#861 (20) { ["member_srl"]=> int(0) ["user_id"]=> NULL ["user_name"]=> NULL ["nick_name"]=> NULL ["email_address"]=> NULL ["phone_number"]=> NULL ["homepage"]=> NULL ["blog"]=> NULL ["birthday"]=> NULL ["denied"]=> NULL ["status"]=> NULL ["is_admin"]=> string(1) "N" ["is_site_admin"]=> NULL ["profile_image"]=> NULL ["image_name"]=> NULL ["image_mark"]=> NULL ["signature"]=> NULL ["description"]=> NULL ["group_list"]=> array(0) { } ["menu_list"]=> array(0) { } } ["request"]=> object(Rhymix\Framework\Request)#10 (13) { ["method"]=> string(3) "GET" ["compat_method"]=> string(3) "GET" ["url"]=> string(32) "javascript/362685/comment/463780" ["hostname"]=> string(8) "eond.com" ["domain"]=> NULL ["protocol"]=> string(5) "https" ["callback_function"]=> string(0) "" ["_route_status":protected]=> int(200) ["_route_options":protected]=> object(stdClass)#11 (5) { ["cache_control"]=> bool(true) ["check_csrf"]=> bool(true) ["is_forwarded"]=> bool(false) ["is_indexable"]=> bool(true) ["enable_session"]=> bool(true) } ["module"]=> string(5) "board" ["mid"]=> string(10) "javascript" ["act"]=> string(16) "dispBoardContent" ["args"]=> array(5) { ["category"]=> string(6) "360820" ["document_srl"]=> string(6) "362685" ["comment_srl"]=> string(6) "463780" ["mid"]=> string(10) "javascript" ["act"]=> string(16) "dispBoardContent" } } ["ajaxRequestMethod"]=> array(2) { [0]=> string(6) "XMLRPC" [1]=> string(4) "JSON" } ["gzhandler_enable"]=> bool(true) }

http://bavotasan.com/2010/add-a-copyright-notice-to-copied-text/

위 사이트에 접속하면 아래와 같은 코드가 있습니다.

<script type="text/javascript"> function addLink() { var body_element = document.getElementsByTagName('body')[0]; var selection; selection = window.getSelection(); var pagelink = "<br /><br /> Read more at: <a href='"+document.location.href+"'>"+document.location.href+"</a><br />Copyright &copy; c.bavota"; // change this if you want var copytext = selection + pagelink; var newdiv = document.createElement('div'); newdiv.style.position='absolute'; newdiv.style.left='-99999px'; body_element.appendChild(newdiv); newdiv.innerHTML = copytext; selection.selectAllChildren(newdiv); window.setTimeout(function() { body_element.removeChild(newdiv); },0); } document.oncopy = addLink; </script>

위 코드를 복사해 자신의 자바스크립트 파일에 붙여넣고 varpagelink 부분을 수정합니다. 이 부분은 복사한 사이트의 URL과 메시지가 출력되는 부분입니다. 제 경우는 아래와 같이 수정했습니다.

 

 272 
function addLink() {
 273 
    var body_element = document.getElementsByTagName('body')[0];
 274 
    var selection;
 275 
    selection = window.getSelection();
 276 
    var pagelink = "<br /><br /> 귀하는 복제를 금지하는 사이트에서 콘텐츠를 복사해 사용하려고 하고 있습니다. 이 콘텐츠를 블로그나 웹사이트 또는 인쇄물의 콘텐츠로 사용하면 저작권 문제로 처벌 받을 수 있습니다. : <a href='"+document.location.href+"'>"+document.location.href+"</a><br />Copyright &copy; 베누시안";
 277 
    var copytext = selection + pagelink;
 278 
    var newdiv = document.createElement('div');
 279 
    newdiv.style.position='absolute';
 280 
    newdiv.style.left='-99999px';
 281 
    body_element.appendChild(newdiv);
 282 
    newdiv.innerHTML = copytext;
 283 
    selection.selectAllChildren(newdiv);
 284 
    window.setTimeout(function() {
 285 
        body_element.removeChild(newdiv);
 286 
    },0);
 287 
}
 288 
document.oncopy = addLink;

내 사이트에서 복사를 하고 자신의 블로그에 붙여넣으면 이미지를 제외한 콘텐츠만 복사되며 하단에 위 메시지가 나타납니다.
 

라이믹스는 이온디와 함께

닫기

마이페이지

로그인을 해주세요

네이버로 로그인