4 ms·Using a DOM element is the most efficient way to do this.by rmanalan 10y agoUsing a DOM element is the most efficient way to do this.fabrice_d 10y agoI would rather use the URL() api : https://developer.mozilla.org/en-US/docs/Web/API/URL https://developer.mozilla.org/en-US/docs/Web/API/URLElizzy 10y agoAbsolutely no IE support though.