I have a small tool build with Delphi that collects url\'s from a file or from the clipboard, and than builds a file called test.htm with a content like this :
I think the best way would be to add "//" + url In this case - it isn't important, what protocol (http or https) you expect to receive as a result.
url = url.match(/^https?:/) ? url : '//' + url; window.open(url, '_blank');