Forum Moderators: open

Message Too Old, No Replies

How to stop IE from blocking Javascript (urgent)

How to stop IE from blocking Javascript (urgent)

         

xsenos

2:51 pm on Sep 4, 2005 (gmt 0)

10+ Year Member



Hi guys,
I was trying to use this simple JS for my clients web-site to make the menu easier to overview (it expands and collapses a table) but when testing it on the latest versions of IE I got this annoying security warning that blocks the script from working.

I'm originally a 3D graphics artist and haven't done any web-design since a couple of years so this problem is something new to me.

Is there anything I can do to make my script IE friendly? How would you guys handle this situation? I really don't want to annoy IE users who don't know how to turn off this security warning on their side.

I'm due to finish the site till this tuesday so any quick advises would be much appreciated.

The script:

/* -------------------------------------------------------------------
* Expandable tabs
* -------------------------------------------------------------------
*/
var theTabs = Array('calendar', 'categories', 'archives', 'links', 'feeds', 'services');

// Expands a tab on user click
// tabID : the base ID of the tab DIVs

function expand_tab(tabID) {
var argv = expand_tab.arguments;
var argc = expand_tab.arguments.length;

if (document.getElementById) {
theTabOn = document.getElementById(tabID + 'On');
theTabOff = document.getElementById(tabID + 'Off');
theContent = document.getElementById(tabID + 'Content');

theTabOn.style.display = 'none';
theTabOff.style.display = 'block';
theContent.style.display = 'block';

}
}

// Collapses a tab on user click
// tabId : the base ID of the tab DIVs
function collapse_tab(tabID) {
var argv = collapse_tab.arguments;
var argc = collapse_tab.arguments.length;

if (document.getElementById) {
theTabOn = document.getElementById(tabID + 'On');
theTabOff = document.getElementById(tabID + 'Off');
theContent = document.getElementById(tabID + 'Content');

theTabOn.style.display = 'block';
theTabOff.style.display = 'none';
theContent.style.display = 'none';
}
}

Iguana

3:53 pm on Sep 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can't see anything here that would disturb IE. What exactly is the security error? Are you trying to access the document object on a different page?

Bernard Marx

4:11 pm on Sep 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This happens on XP SP2. It only happens when the page is within the local zone.
Here's the usual solution: [webmasterworld.com...]

xsenos

4:18 pm on Sep 4, 2005 (gmt 0)

10+ Year Member



Thanks for the reply.

The warning message (a yellow bar on the top of the site) says that IE has restricted the site from showing active content that could access my computer. You have to click it and click on Allow blocked content... to turn your scripts on.

I noticed that the message appears even if the document only contains <script></script> tags and nothing more.

Apparently this is the default security status for many IE users today (including me, my client and several other new computers I've tested it on). I assume it came with WinXP SP2 or something.

Has IE declared war on JavaScript in general or am I just doing something wrong?

Is there any way how to let the latest versions of IE to accept simple JS with the default security settings turned on, ie. is there any way how to "legalise" my script for IE?

xsenos

4:21 pm on Sep 4, 2005 (gmt 0)

10+ Year Member



Bernard: Just noticed your reply, looks like what I was looking for, thanks in advance!