PDA

View Full Version : Bypass IE ActiveX Blocking?


jrjw
07-02-2008, 10:24 AM
I've got a bit of Javascript used to randomise an image on the front page of a website I've been working on. It works fine, but the default setting on IE (mine anyway) is to "restrict this webpage from running scripts or ActiveX controls that could access your computer" - so it returns a blank page until I click to "allow blocked content." I'm concerned potential visitors may have the same problem. Is there a better way to do what I want or can I change the code somehow? I don't see how generating a random number may harm my computer...

The code is:

<script type="text/javascript" language="JavaScript">
// Random Image Generator
NumberOfImagesToRotate = 8;
FirstPart = '<img src="images/splash';
LastPart = '.jpg" height="400" width="760" style="position: absolute; top: 90px; left: 0px;">';
function printImage() {
var r = Math.ceil(Math.random() * NumberOfImagesToRotate);
document.write(FirstPart + r + LastPart);
}
//-->
</script>

followed by:

<script type="text/javascript" language="JavaScript">
printImage();
</script>

I've tried the same thing in PHP which works ok, but it's not so easy to test or play around with (and I don't really know what I'm doing!). Any other ideas?

Philip M
07-02-2008, 11:12 AM
These are security settings which are part of the user's browser and under his control. You cannot by-pass it (Thank Heavens!)

In IE: Tools > Internet Options > Security > Custom Level > Scripting > Active Scripting > Enable

I am told that 20% of users have Javascript disabled.

jrjw
07-02-2008, 02:20 PM
I don't really understand why a random number generator is affecting my computer's security settings. Isn't there another way to do this? I know I could do it in Flash or something but then I have to worry about whether that's installed or not...

Philip M
07-02-2008, 02:47 PM
The security settings are in the browser, and your random number script has nothing to do with it. The script works fine for me. Adjust your browser settings as instructed.

For more info see:-

http://www.apl.org/libcats/enable.html

_Aerospace_Eng_
07-02-2008, 05:28 PM
What Philip failed to mention was that these warnings usually happen only locally. Test your page on a server and they will likely go away.

jrjw
07-03-2008, 10:54 AM
Thanks, guys. No, I know I can easily change the settings on my browser but I don't want the same thing happening to other people. I'll try it again on a server - thank you both for your help.

barkermn01
07-03-2008, 04:23 PM
Warnings
ActiveX, is not bypassable

javascript, you can allways allow on the local settings

but when site is live javascript will not ask for permison to run