【发布时间】:2018-01-02 11:35:02
【问题描述】:
我想从 URL 中提取 TLD,但它给了我整个 URL。 例如https://www.google.com.uk -> .com.uk。
$(document).on("click", "a", function() {
var href = $(this).attr("href");
alert(href)// It gives me the whole link of website
if(href.search(".com.uk")){
alert("This website is AUTHENTIC!");
}
else
{
alert("Not AUTHENTIC!")
}
【问题讨论】:
-
.co.uk不是顶级域名,而是二级域名。充其量是eTLD,需要自定义案例。
标签: javascript google-chrome-extension