如何隐藏基于Geo位置的html页面..?

问题描述 投票:-2回答:1

考虑到我有一个HTML页面..

我想向不是来自印度(IN)的用户显示该页面,并向其他国家/地区的用户显示该页面...

https://einthusan.tv ..

请任何人帮我完整的工作代码....

javascript php html
1个回答
0
投票

你可以用它

$.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>
© www.soinside.com 2019 - 2024. All rights reserved.