【发布时间】:2013-01-13 19:50:39
【问题描述】:
我想在索引页面中插入一些 Jquery 代码,以根据访问者的地理 ip 位置将访问者重定向到以下页面。
if user ip is from AU then show:
http://www.propertyhere.com/Country/AU/search-to-buy;
if user ip is from CA then show:
http://www.propertyhere.com/Country/CA/search-to-buy;
if user ip is from NZ then show:
http://www.propertyhere.com/Country/NZ/search-to-buy;
if user ip is from US then show:
http://www.propertyhere.com/Country/US/search-to-buy;
if user ip is from CN then show:
http://www.propertyhere.com/Country/CN/search-to-buy;
if user ip is from RU then show:
http://www.propertyhere.com/Country/RU/search-to-buy;
如果访问者的 ip 与上述位置不匹配,则让访问者留在首页。
【问题讨论】:
-
您是否有特殊原因需要在客户端执行此操作?我强烈建议在服务器端执行此操作,并使用适当的 301/302 状态代码和
Location标头进行重定向。此外,无论如何,您都需要服务器端的东西来确定网络地址。 -
你们有根据ip地址查找位置的服务吗?如果没有,您将需要一个
标签: javascript jquery redirect ip