考虑到我有一个HTML页面..
我想向不是来自印度(IN)的用户显示该页面,并向其他国家/地区的用户显示该页面...
请任何人帮我完整的工作代码....
你可以用它
$.get("https://ipinfo.io", function(response) {
console.log(response.city, response.country);
if(response.country == 'KR'){
//handle your logic here
alert('You can not see this content');
//window.location.href = '/yourlink';
}
}, "jsonp");
$.get("https://ipinfo.io", function(response) {
console.log(response.city, response.country);
if(response.country == 'KR'){
//handle your logic here
alert('You can not see this content');
//window.location.href = '/yourlink';
}
}, "jsonp");
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>