HTML获取用户IP

发布于 2022-06-09  99 次阅读


let _script = document.createElement('script');
		_script.setAttribute('charset', 'utf-8');
		_script.setAttribute('type', 'text/javascript');
		_script.setAttribute('src', 'https://pv.sohu.com/cityjson?ie=utf-8');
		document.getElementsByTagName('head')[0].appendChild(_script);
		_script.onload = function () {
		    alert(returnCitySN['cip']);
		};