Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to restrict facebook related code when user access from china

 
chaitanya pai
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a page where facebook plugin need to be loaded and displayed. It is working fine. But if user try to access the same page from china, where facebook is blocked, page loading is taking too much time.
This is because my page is keep on trying to connect to facebook to download the page and connection timed exception is coming. Can any one of you help me resolving this problem.

I think the implementation can be some thing like, first check whether the user network allows facebook or not. If it allows then download the plugin otherwise dont download the plugin. But dont know how to achieve this.

Any suggestions would be of great help

Thanks in advance,

Chaitanya.
 
Tim Moores
Bartender
Posts: 2789
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can check the IP address of the request, and then use an API like Maxmind GeoIP to figure out the country from that - if it's China, serve appropriate content.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic