I'm now using window.URL object to work with url:
var url = new window.URL(text);
return url.host + url.pathname;
but it looks like IE does not pletely support it.
What universal solution could you remend?
I'm now using window.URL object to work with url:
var url = new window.URL(text);
return url.host + url.pathname;
but it looks like IE does not pletely support it.
What universal solution could you remend?
I use parseURI.js by Steven Levithan: http://blog.stevenlevithan./archives/parseuri
It's small but prehensive. To use it to do the same job as your snippet:
var url = parseUri(text);
return url.host + url.path;
I use this one as a backup for IE, this is an implementation of w3c specs maintained by PolymerJS https://github./webponents/URL