如何在你的网站上加上IPV6检测功能

180it 2021-11-12 PM 1934℃ 0条

直接贴代码,此代码依赖jQuery

<span id="ipv6-span" style="color:red;">你的网络不支持IPV6</span>
<br>
<span id="ipv4-span" style="color:red;">你的网络不支持IPV4</span>
<script>
    jQuery.ajax({
        url: 'https://v4.yinghualuo.cn/bejson',
        type: 'get',
        dataType: 'json',
        success: function(json) {
            jQuery('#ipv4-span').css('color', 'green');
            jQuery('#ipv4-span').html('你的网络完美支持IPV4<br>' + json.ip);
        }
    });
    jQuery.ajax({
        url: 'https://v6.yinghualuo.cn/bejson',
        type: 'get',
        dataType: 'json',
        success: function(json) {
            jQuery('#ipv6-span').css('color', 'green');
            jQuery('#ipv6-span').html('你的网络完美支持IPV6<br>' + json.ip);
        }
    });
</script>

如果您需要在您的网站上调取此跨域请求接口,请联系博主批准后再正式运营。博主不能保证未批准的服务稳定性

支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

如何在你的网站上加上IPV6检测功能