It considers any protocol, you can replace this by: 

```
if (!url.match(/^https?:\/\//i)) { 
```