dom - parse url - javascript -
i try parse url in angular way:
var l = document.createelement("a"); l.href='www.example.com'; console.log(l.hostname); // -> '127.0.0.1'
but log gives me localhost. ideas why that's case or better ways how it?
you should use absolute url protocol:
l.href='http://www.example.com';
Comments
Post a Comment