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

put on hold as too broad by MichaelT, Scant Roger, Snowman yesterday

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the 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

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
Feature detection seems to be the best solution in most cases. – biziclop yesterday
That won't help for the majority who don't use IE. – Rob yesterday
@Rob There isn't much you can do that. I assume that the website is some kind of internal application which doesn't work on other browsers and requires those features. – CodesInChaos yesterday

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

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
I think you understood the question. It's not about determining if the client is in a trusted location, but about checking if IE has whitelisted the website using it's "Trusted Sites" zone, which enables some features not available for the internet zone by default. – CodesInChaos yesterday

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