gpt4 book ai didi

javascript - 在地理位置上显示 div

转载 作者:行者123 更新时间:2023-11-28 11:08:16 25 4
gpt4 key购买 nike

是否有任何脚本可以根据用户位置显示不同的 div?

我想做的是根据国家/地区显示正确的运输信息。

例如,我有 3 个 divs 英国、欧洲、美国。 UK 被设置为默认值,其他 2 个被隐藏。如果脚本检测到用户来自美国,它将隐藏 UK div 并显示 USA div。

非常感谢任何帮助。

最佳答案

Now, as we all know IP addresses are far from perfect so the best you’re going to get seems to be ~80% accuracy. That said, there are still a lot of great things you can do for those people if you know where they are coming from.

您只需执行以下操作:使用 Javascript given in this page , 然后根据 IP 地址使用 javascript 显示/隐藏分区。

关于javascript - 在地理位置上显示 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22131020/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com