views:

902

answers:

3

I'd like to be able to detect Vista IE7 Protected Mode within a page using javascript, preferably. My thinking is to perform an action that would violate protected mode, thus exposing it. The goal is to give appropriate site help messaging to IE7 Vista users.

+2  A: 

What are you trying to accomplish that is substantially different for protected users? I've seen some window popup issues, but otherwise, clean JavaScript tends to be less affected. If you're finding that a block of code won't execute, why not do a check after attempted execution to see if the document is the state you expect, and alert if not.

If it's it using ActiveX, MS has a Protected Mode API: http://msdn.microsoft.com/en-us/library/ms537316(VS.85).aspx

Protected mode is customizable, so you don't really have a reliable way of detecting it based on action violation. And many users disable UAC, so detecting via version won't work either (not to mention you may have the same headache with IE 8. Always best to test if something worked instead of assume by version.)

A: 

Adobe Flash may behave differently (or not as expected) in Vista IE7 Protected Mode. The intention is to provide this feedback to the user.

jdev
If I had Flash which wasn't working in protected mode, I'd try to fix my use of Flash to work around that. Many users won't understand the problem if you explain it, and those that do may be unwilling to turn off protected mode. (unless, of course, you have a safe workaround...)
Mr. Shiny and New
A: 

I reviewed the MSDN documentation of the Protected Mode API from 6t7m4, and if I could call the ieframe.dll from javascript, such as:

var axo = new ActiveXObject("ieframe.dll");

I would be able to access the IEIsProtectedModeProcess() function, but I believe it's inaccesible due to security reasons.

jdev
You should include these updates as edits to your original question.
recursive