Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: Re: VBScript Error in MSIE 4 (Mac)
From: Bob James
Date: Fri, 20 Feb 1998 03:55:06 GMT

If you remember, at 06:29 AM 2/20/98 , joachim.gola wrote:
>On Mac MSIE 4 (and probably other versions) the lines
>
><SCRIPT LANGUAGE=VBScript>
><!--
> on error resume next
> FlashMode = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash")))
>-->
></SCRIPT>
>cause an error that reads "This page contains Active Scripting" scripts written in VBScript. (�) do you want to continue ?".
>
>It looks like a bug: if it does not support, why does it read the <Script>-Tag??!

It's not a bug, it's a feature! <g>

Joachim, you don't know how I struggled with this after IE4/Mac came out. I had done an elaborate set of pages that had to have client-side scritping and had exactly the same problem.

There are two ways around it.
1) Do a document.write only for MacIE users that either gives them the following message or provides a link to click that takes them to page where you give them this message:

"If you are receiving error messages, this is because IE4 for the Mac is a piece of crap. You can permanently disable these error alerts by going to Preferences and selecting Web Content from the list on the left. On the right panel, change the setting for Active Scripting Alerts to None. From now on, pages will come up correctly with no alerts."

2) You can also use JavaScript to write the VBScript code, which eliminates the error messages so no message to IE4/Mac users is needed.

My code for this looks like this:

-- First, design a browser detect that pulls out IE FOR WINDOWS 95/NT -- not the Mac. In my case, the function is called "isIE" Then, after that function, I put this:


if(isIE) {
document.write("<SCRIPT LANGUAGE='VBScript'\>\n");
document.write("Sub m1_Change()\n");
document.write("call relateItems\n");
document.write("End Sub \n");

document.write("Sub m2_Change()\n");
document.write("call gotoPage\n");
document.write("End Sub\n");

document.write("Sub Window_onLoad() \n");
document.write("call addHeadings\n");
document.write("End Sub\n");
document.write("</SCRIPT\>\n");
}

The "\n" is necessary at the end of each line, or it causes VBScript parsing errors. However, instead of \n you could also use DOCUMENT.WRITELN, I suppose. I found this worked better, though.

Using JS to write VBS is tricky. Sometime the code won't parse on Windows afterward, so make sure you test, test, test.

Good luck and e-mail me PRIVATELY if you need more help.





-----------------
Bob James - Website design & content developer

The Asian Adventure     http://www.iac.co.jp/~bobj/
WebJournalist.com    http://www.webjournalist.com/
The Hub               http://www.trafficworld.com/reg/tlinks/index.html

Replies
  Re: VBScript Error in MSIE 4 (Mac), Aaron Salo

Replies
  VBScript Error in MSIE 4 (Mac), joachim.gola

[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]