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 made small changes function form answered by iMoses which worked for me.
Check for both https OR http protocol
if (!url.match(/^http?:\/\//i) || !url.match(/^https?:\/\//i)) { url = 'http://' + url; }
Hope it make more accurate for other situation !