Funciones de JavaScript que jamás deberías usar
JavaScript puede ser muy malo con los usuarios de tu página, Kilian Valkhof a recopilado algunos de los scripts más molestos dando como resultado: Annoying.js.
/** * Annoying.js - Cómo ser un cabrón con tus usuarios * * NUNCA USES ESTO. * * Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com) * Visit https://gist.github.com/767982 for more information and changelogs. * Licensed under the MIT license. http://www.opensource.org/licenses/mit-license.php * */ (function(a) { /** * Cambiar el tamaño de la ventana (1024x768 siempre) */ a.fullScreen = function () { window.resizeTo(1024,768); }; /** * Deshabilitar el botón derecho del mouse, para evitar copiar */ a.noRightClick = function () { document.oncontextmenu = function(){return false} }; /** * Asegurarse de no abrirse en un iframe */ a.onTop = function () { if (parent.frames.length > 0) { alert ("No se permiten los frames; presiona OK para removerlos.") top.location.replace(document.location); } } /** * Deshabilitar el arrastrar fotos o texto, otra forma de evitar que copien los usuarios */ a.noDrag = function () { document.ondragstart = function(){return false} }; /** * Deshabilitar la selección de texto, un vez más para no copiar */ a.noSelect = function () { //no text selection, in IE document.onselectstart=function(){ if (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password") { return false } else { return true; } }; //no text selection, in Firefox document.onmousedown=function(e){ var obj=e.target; if (obj.tagName.toUpperCase() == "INPUT" || obj.tagName.toUpperCase() == "TEXTAREA" || obj.tagName.toUpperCase() == "PASSWORD") { return true; } else { return false; } } }; /** * Evitar que cierren la página. */ a.dontLeave = function (msg) { var message = msg || "Por favor regresa!!!"; window.onunload=function() { function dontLeave() { alert(message); } dontLeave(); } }; /** * Deshabilitar los comandos de copiar (ctrl + c) */ a.noCopy = function () { window.onkeydown = function(e) { if (e.ctrlKey == true) { return false; } } } /** * Ejecutar todas las funciones anteriores */ a.kitchensink = function () { this.fullScreen(); this.noRightClick(); this.onTop(); this.noDrag(); this.noSelect(); this.dontLeave(); this.noCopy(); }; }(Annoying));
Estas funciones son ideales para mantener alejados a tus visitantes, realmente pueden llegar a fastidiar, creo que la función del iframe puede ser útil para evitar no sólo que copien contenido de tu página, sino para evitar que consuman ancho de banda de tu sitio, pero mientras no llegue al límite, estoy a favor de compartir…
Últimos comentarios