SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member DavidVII's Avatar
    Join Date
    Apr 2010
    Location
    Glendale
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Display Content Based on IP Address

    Hi everyone! I'm currently interested in displaying a quick line or two of copy if a visiter's IP address falls between a certain IP range. Do any of you have any resources or ideas of how I can go about it?

    I'd like to use JS (maybe jQuery?) for this. I'd imagine I can use JS to detect the IP then use an IF statement to display said content. I'm pretty new to JS and is the reason why I would love some help from ya'll

    Any help is MUCH appreciated. Thnx!

  2. #2
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,524
    Mentioned
    52 Post(s)
    Tagged
    1 Thread(s)
    http://www.maxmind.com/app/geolitecountry
    http://www.maxmind.com/app/api

    or

    http://www.hostip.info/
    http://www.hostip.info/use.html


    You'll probably have to use a server side language with maxmind, then with JS, you can do an AJAX request. Same goes for hostip, since it would be from a different domain.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain

  3. #3
    SitePoint Member DavidVII's Avatar
    Join Date
    Apr 2010
    Location
    Glendale
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was really hoping for some raw javascript or some jQuery. Don't really want to rely on pre built stuff. I'm new to JS and would like to know if it's even possible. Without server side scripting.

    As always, much appreciated...

  4. #4
    Barefoot on the Moon! silver trophy
    Force Flow's Avatar
    Join Date
    Jul 2003
    Location
    Northeastern USA
    Posts
    4,524
    Mentioned
    52 Post(s)
    Tagged
    1 Thread(s)
    Nope, not really. You need to communicate with something in order to use geoIP. The geoIP data needs to be looked up somehow, and that can't be done with just javascript. Javascript is a client-side language, only responsible for things that happen within the browser.
    Visit The Blog | Follow On Twitter
    301tool 1.1.5 - URL redirector & shortener (PHP/MySQL)
    Can be hosted on and utilize your own domain


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •