Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    151
    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:
    769
    Likes Received:
    2
    Trophy Points:
    168
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    166
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. nickp666

    nickp666 Well-Known Member

    Joined:
    Jan 28, 2005
    Messages:
    769
    Likes Received:
    2
    Trophy Points:
    168
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    166
    Fair enough, that makes sense to me.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice