|
@ -30,10 +30,10 @@ var _rules = [ |
|
|
var BAD_PROTOCOLS = [ 'vbscript', 'javascript', 'file' ]; |
|
|
var BAD_PROTOCOLS = [ 'vbscript', 'javascript', 'file' ]; |
|
|
|
|
|
|
|
|
function validateLink(url) { |
|
|
function validateLink(url) { |
|
|
var str = url.trim().toLowerCase(); |
|
|
|
|
|
|
|
|
|
|
|
// Care about digital entities "javascript:alert(1)"
|
|
|
// Care about digital entities "javascript:alert(1)"
|
|
|
str = replaceEntities(str); |
|
|
var str = replaceEntities(url); |
|
|
|
|
|
|
|
|
|
|
|
str = str.trim().toLowerCase(); |
|
|
|
|
|
|
|
|
if (str.indexOf(':') >= 0 && BAD_PROTOCOLS.indexOf(str.split(':')[0]) >= 0) { |
|
|
if (str.indexOf(':') >= 0 && BAD_PROTOCOLS.indexOf(str.split(':')[0]) >= 0) { |
|
|
return false; |
|
|
return false; |
|
|