0

I want to disable a script (mixpanel tracking software) for users from two unique IP addresses that are my AWS servers - is there a javascript function to do this automatically from the front-end?

I'm looking for something like this:

if (!(ipaddress1 || ipaddress2)){
    //run the script
}
3
  • What server-side language are you using? Commented Jan 6, 2014 at 23:38
  • Just don't include the script in the page that you deliver to your ASW servers - your server-side language should be able to do that easily. A javascript in a page cannot know to which IP it was delivered (or if at all?) Commented Jan 6, 2014 at 23:39
  • possible duplicate of this <stackoverflow.com/questions/391979/…> Commented Jan 6, 2014 at 23:47

1 Answer 1

3

There's no native way to do this, you'll need to use a service like jsonip (currently over quota) or you could make an AJAX request to your server (where you do have access to the requesting IP) and return it, bypassing the need for an external service.

Sign up to request clarification or add additional context in comments.

4 Comments

The link your provided is over quota.
Yeah. Fortunately it's easy to roll your own. I'll edit to reflect that.
That's a neat service but requires one to already know the IP.
@SomeKittens - I didn't actually read it in details... I just threw in the first result I found on Google :v

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.