Javascript 如何根据地理位置隐藏html页面。。?

Javascript 如何根据地理位置隐藏html页面。。?,javascript,php,html,Javascript,Php,Html,假设我有一个html页面 我想显示该网页的用户不是从印度和显示该网页的用户从其他国家 像 请任何人帮我提供完整的工作代码……您可以使用此 $.get("https://ipinfo.io", function(response) { console.log(response.city, response.country); if(response.country == 'KR'){ //handle your logic here alert('Y

假设我有一个html页面

我想显示该网页的用户不是从印度和显示该网页的用户从其他国家

请任何人帮我提供完整的工作代码……

您可以使用此

$.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");
$.gethttps://ipinfo.io,函数响应{ console.logresponse.city、response.country; ifresponse.country=='KR'{ //在这里处理你的逻辑 警告“您无法看到此内容”; //window.location.href='/yourlink'; } },jsonp;