Last active
December 15, 2018 10:41
-
-
Save demonio/a120cbd57a510565b85f5d4bf834afc4 to your computer and use it in GitHub Desktop.
Una medida para restringir el acceso a los bots a enlaces sensibles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Ejemplo objetivo: --> | |
<div style="text-align:center; margin-top:25px"> | |
<!-- Debe añadir la clase link-anti-bot al enlace a proteger, así como {slash} y {dot} por cada / y . que contenga: --> | |
<h2>Telegram: <a class="link-anti-bot" data-href="https:{slash}{slash}t{dot}me{slash}joinchat{slash}Et_yWw5qkbiGVFQvOqJokw"><img src="/img/telegram.png" style="vertical-align:middle" width="128"></a></h2> | |
</div> | |
<!-- Código a copiar abajo del todo en el template: --> | |
<!-- Si la página carece de jQuery incluya la siguiente linea: --> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<script> | |
// El requisito para usar este anti-bot es poner las / como {slash} y los punto como {dot} en las URLs que se quiere proteger | |
$('.link-anti-bot').each(function() | |
{ | |
var link = $(this).data('href'); | |
link = link.replace(/{slash}/g, '/').replace(/{dot}/g, '.'); | |
$(this).attr('href', link); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment