Last active
August 22, 2016 21:13
-
-
Save sputnick-dev/1f9a306143fb9bfaab999bc3c043a55b to your computer and use it in GitHub Desktop.
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
// ==UserScript== | |
// @name alert_on_non_ascii_url | |
// @namespace sputnick | |
// @include https://* | |
// @include http://* | |
// @version 2 | |
// @grant none | |
// @run-at document-start | |
// ==/UserScript== | |
var hasMoreThanAscii = document.location.href | |
.split("") | |
.some(function(char) { return char.charCodeAt(0) > 127;}); | |
// FF chrome | |
if (hasMoreThanAscii || /^https?:\/\/xn--/.test(document.location.href)) | |
alert(document.location.href+ " have non ASCII characters in URL."+ | |
"\nAre you sure this is not a phishing (Pascal-trap©®™) ?!"+ | |
"\nClose the tab in case of doubt..."); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment