标签:like log domain element name level get oca .com
url = window.location.hostname; // get host name like http://www.baidu.com
var res = url.split(‘.‘); // split by dot
var top_level_domain = res[res.length - 1]; // get last element in array
console.log(top_level_domain); // com
标签:like log domain element name level get oca .com
原文地址:http://www.cnblogs.com/lzbrest/p/7028645.html