查看当前网站IP及归属地书签工具

简爱代码>JavaScript2016-5-27 20:1646302

查看当前网站 IP 移机 归属地 信息的书签小工具,方便自己获取当前域名的 IP, 省得自己再去 ping 了

拖动下面链接 到 浏览器书签工具栏即可保存

网站IP、归属地

源码

javascript:(function(){/*@ 获取网站 IP 信息 */
	if(window.showAddressInfoWin){
		window.showAddressInfoWin.style.display = "block";
	}else{
		var js = document.createElement("script");
		js.src = "http://api.asilu.com/ip/?callback=showAddressInfo&ip="+ window.location.host;
		js.onload = js.onreadystatechange = function(){
			if (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") {
				js.parentNode.removeChild(js);
			}
		};
		document.getElementsByTagName("head")[0].appendChild(js);

		window.showAddressInfo = function(a){

			var d = document.createElement("div"),
				x = document.createElement("div");
			d.innerHTML = [a.ip, a.dz, a.wl].join("<br>");
			d.style["z-index"] = 198904;
			d.style.textAlign = "canter";
			d.style.display = "block";
			d.style.position = "fixed";
			d.style.top = d.style.right = "5px";
			d.style.padding = "5px 20px 5px 10px";
			d.style.background = "#fff";
			d.style.color = "#000";
			d.style.font = "12px Arial";
			d.style.lineHeight = "18px";
			d.style.border = "1px solid #ccc";

			x.innerHTML = "×";
			x.title = "关闭";
			x.style.position = "absolute";
			x.style.color = "red";
			x.style.padding = "3px";
			x.style.cursor = "pointer";
			x.style.font = "14px Arial";
			x.style.top = x.style.right = 0;
			x.onclick = function(){d.style.display = "none";};

			d.appendChild(x);
			window.showAddressInfoWin = d;
			document.body.appendChild(d);
		};
	}
})();

https 网站 无效,调用的接口 没有申请 SSL 证书



本文出自简爱博客,转载时请注明出处及相应链接。

评论

  1. 小瑞₪博客2017-08-21 18:49回复

    请问IP的数据是采用本地的还是其他网站的IP数据?可否共享一下源码?

    1. 简爱2017-08-31 13:59回复

      @小瑞₪博客:https://github.com/NauxLiu/IpLocation