The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Having javascript run based on country ip [moved]

Discussion in 'General Discussion' started by estado3, Jul 4, 2006.

  1. estado3

    estado3 Member

    Joined:
    May 12, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    I am wondering how to do this, I have a few javascripts, but I would like to have the javascripts run based on the country up of the visitor, I am using cpanel with apache 1.3.36 with cpanel build 10.8.2.stable-120. The javascript code is simply added to html, but I want certain javascript to show based on the country ip.
     
  2. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    javascript (unless you mean jsp) is a client side scripting language and is irrelevant of the server, you will need to code a script to detect the locale from the browser and switch to the relevant javascript
     
  3. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    Certain server-based variables, such as the user agent, are passed on to JS and I wouldn't be surprised if the user's IP present.
     
  4. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    770
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    /dev/null
    the user agent is retrieved client side again, to my knowledge i dont think you can get the external IP of the user, only the internal
     
  5. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    Fair enough, that makes sense to me.
     
Loading...

Share This Page