I'd like to make sure URLs such as
javascript:alert('a');
and vbscript varients etc. are not allowed by whitelisting https?|ftp
That's easy enough: ^(?:https?|ftp)://
But how can I allow relative urls as well?
such as ../../../blah and ./blah also /images/img.png
In other words is using ^(?:(?:https?|ftp)://|[./])
safe?
I've asked around and a possible solution might be: parse_url
if !scheme or scheme == http or scheme == https or scheme == ftp or scheme == mailto