PDA

View Full Version : DHTML Window "Unspecified Error" in IE 6 and 7



mex666
01-21-2009, 07:05 AM
1) Script Title: DHTML Window 1.1

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe problem:

I have a lot of IE users on my site getting "Unspecified Error" when they try to open windows. The error is on the open window function.

I think they have "Binary and Script Behaviors" disabled in thier security poilcies. If I disable this we get the same error.

But I can't easily tell these users to change this setting, so I was wondering which part or line of the window open code is causing this error, so that I can turn it off or modify it in a way that this setting wont stop windows from opening.

Kind Regards
Mex

jscheuer1
01-21-2009, 04:55 PM
If that is indeed the problem, this will fix it - replace (in dhtmlwindow.js):


setopacity:function(targetobject, value){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
if (!targetobject)
return
if (targetobject.filters && targetobject.filters[0]){ //IE syntax
if (typeof targetobject.filters[0].opacity=="number") //IE6
targetobject.filters[0].opacity=value*100
else //IE 5.5
targetobject.style.filter="alpha(opacity="+value*100+")"
}
else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
targetobject.style.MozOpacity=value
else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
targetobject.style.opacity=value
},

with:


setopacity:function(targetobject, value){ //Sets the opacity of targetobject based on the passed in value setting (0 to 1 and in between)
if (!targetobject)
return
/*@cc_on @*/
/*@if(@_jscript_version >= 5)
try{
@end @*/
if (targetobject.filters && targetobject.filters[0]){ //IE syntax
if (typeof targetobject.filters[0].opacity=="number") //IE6
targetobject.filters[0].opacity=value*100
else //IE 5.5
targetobject.style.filter="alpha(opacity="+value*100+")"
}
else if (typeof targetobject.style.MozOpacity!="undefined") //Old Mozilla syntax
targetobject.style.MozOpacity=value
else if (typeof targetobject.style.opacity!="undefined") //Standard opacity syntax
targetobject.style.opacity=value
/*@cc_on @*/
/*@if(@_jscript_version >= 5)
}catch(e){};
@end @*/
},

Note: Be sure to clear your cache after making the change, otherwise an old copy of the script may still be in use, and give the same error.

mex666
01-21-2009, 11:14 PM
Thanks John

Putting that try/catch around that opacity code seemed to do the trick for people with that security poilcy setting. Thanks for posting that fix :cool:

I'm sure some corporate desktop rollouts have this security policy option set to 'disabled' so I think this might help quite a few users who may not even be aware thier customers are getting the error. I only noticed because I catch js errors and forward them to a server side email alert.

Now fingers crossed there isn't some other cause of this error for some of our users ;)

Cheers
Mex

jscheuer1
01-22-2009, 01:37 AM
Generally only the dynamic use of filters or Active X objects (like the Msxml2.XMLHTTP Active X object used with AJAX) will cause this sort of error, and then only in IE browsers that have Binary and Script Behaviors or other 'safe' Active X* methods disabled. I placed quotes around safe because, depending upon many circumstances, these so called safe behaviors may not be safe. However, with all of the latest security updates (available free from MS via Live Update, also free and applied automatically when Automatic Update is enabled) it is at least thought that they are in fact safe. But there have been documented cases of attacks on older systems that do not have the latest security patches, and upon systems running IE prior to the availability of these patches, via these behaviors.

At that time many admins simply disabled them. Once a measure like that is in place, it is often never removed, even when the threat has passed. It can even go so far as becoming standard in some organization's rollouts.

All javascript code that uses any of the Active X features of IE should have something like what I supplied as the fix in this case. However, most folks who write scripts are either unaware of the problem, the fix, or both. And some may know about both, but don't think that it's all that important.


* 'Safe' Active X should not be confused with some of the more advanced Active X techniques that rely upon remote control over a local machine. These are still unsafe in all cases unless they come from a trusted source. Generally, if you have your security set to default levels, you will at least be prompted before these are allowed to run.

It is due to this and many other issues that I would recommend anyone and any organization not to use IE as a browser.

mex666
02-05-2009, 07:30 AM
Thanks for the in depth repsonse on this, I think we had a small percentage of people with this problem, but a large total volume, meaning quite a few individuals getting this error with those settings.

Also I concure with recommending anyone not to use Internet Explorer :D

Cheers
Mex