Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

I am working on site which have a lot of configuration and security settings and I have to check either clients browser is on trusted zone or not using JavaScript.

Is it possible to determine whether my web site is being accessed as a trusted site?

The reason I'd like to do this is that some functions won't work unless the site is being accessed as a trusted site, and I'd like to be able to warn users.

Is there any solution ?

share|improve this question
Is there some simple test function you can run that will work if in a trusted site and not work if not in a trusted site? – jfriend00 Nov 23 '11 at 7:03

3 Answers 3

You can't ask the browser that kind of information, but there are similar things you can do. Doing so would not be secure as the client could be falsifying its data. You must use another approach.

The incoming connection will contain the IP address of the browser. If the address is in the trusted zone. Exclude the IP address of any Source NAT routers in the trusted zone.

If the IP addresses in the trusted zone are in the private address ranges, do NOT use Javascript to determine the address of the remote client. It will be totally unreliable for your purposes.

share|improve this answer

Sorrry sameer, but you can't do that. Verifying that kind of data is not supported by browsers. You can only fetch the browsers name, version and simple stuff like that. The browsers are pretty smart, they just don't hand such information which are matters of privacy concern.

If your code works for visitor, then do your thing or else warn him to enable javascripts. Thats the most you could do.

share|improve this answer
You can use cookies, but you need some bootstrap for that – Raynos Nov 23 '11 at 13:26

The IE "Trusted Sites" zone may have different options enabled and disabled on different computers. For example, some might allow unsigned ActiveX controls, others not. Therefore you will need to use feature detection.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.