Converting VBScript to JavaScript

I have the following piece of code that was written in VBScript, but of course Netscape doesn't like VBScript and only works with JavaScript.  So I need somebody who can convert this script into JavaScript so that it will work in both IW and Netscape

<script language="vbscript">
<!--
function window_onload ()
on error resume next
var flashmode
flashmode = isobject (createobject ("ShockwaveFlash.ShockwaveFlash.3"))
if flashmode=false then
flashmode = isobject (createobject ("ShockwaveFlash.ShockwaveFlash.4"))
end if
if flashmode=false then
location.pathname="default6.htm"
end if
end function
-->
</script>
cavacaspAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mgfranzCommented:
So you are running Netscape for your web server?
0
DreamMasterCommented:
looks like You're trying to detect Flash... You can use it as follows...

Write a browser detection script...

<script language="Javascript">
<!--
  var AppName = navigator.appName;
  var IsExplorer = AppName.indexOf("Microsoft")!=-1;
  var IsNetscape = AppName.indexOf("Netscape")!=-1;
  var IsMac = navigator.platform && (navigator.platform.indexOf('Mac')!=-1);
  var versie = parseInt(navigator.appVersion);

  if (IsMac && IsExplorer) location.href='whereeverto.html';
  if (IsNetscape && versie >= 4)
    CheckPlugin('Shockwave Flash','flashpage.html','nonflashpage.html',true)
  if (IsNetscape && versie < 4)
    CheckPlugin('Shockwave Flash','','',true)

  else if (IsExplorer)
  {
     if (versie >= 4)
       IEdetected();
     else
       location.href='smartsite.asp?id=844';
  }
//-->
</script>


Then for Netscape....

<script language="JavaScript">
<!--
function CheckPlugin(plugin, theURL, altURL, IEGoesToURL) { //v2.0
  if ((navigator.plugins && navigator.plugins[plugin]) || //if NS, or
      (IEGoesToURL &&  //if flag set, and MSIE browser for Win95/NT (ActiveX)
       navigator.appName.indexOf('Microsoft') != -1 &&
       navigator.appVersion.indexOf('Mac') == -1 &&
       navigator.appVersion.indexOf('3.1') == -1)) {
    if (theURL.length>2) window.location = theURL;
  } else {
    if (altURL.length>2) window.location = altURL;
  }
  document.MM_returnValue = false;
}
//-->
</script>

That's the function NS uses..You could send IE to Your VB function...i send it to a function called IEDetected, which was also VB, so this should help You...

i hope this is helpfull...if You don't understand anything just ask...
0
JagarCommented:
If you don't mind can you walk through the code for me.  There are some parts that I don't understand for example what is wherever.htm and some other parts.
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

JagarCommented:
No IIS on the Web Server.  The problem is Netscape clients.
0
mgfranzCommented:
Unless you are trying to run .asp code client side, there is no issue of running vbscript on the server to process server apps.

To run server side;

<HTML>
<head>
<%
function window()
on error resume next
var flashmode
flashmode = isobject (createobject ("ShockwaveFlash.ShockwaveFlash.3"))
if flashmode=false then
flashmode = isobject (createobject ("ShockwaveFlash.ShockwaveFlash.4"))
end if
if flashmode=false then
location.pathname="default6.htm"
end if
end function

%>

<BODY onload="window()" >

You need to differentiate between server-side & client side.

http://msdn.microsoft.com/training/free/mwd64/mwd9800334.htm

Mark




0
JagarCommented:
I know and this is running client side to check ans see if the user has the Player installed on the local PC.
0
DreamMasterCommented:
ok Jagar...

the whereeverto.html is a page You might load to avoid browsers that don't have flash or don't know how to detect it, where to go..for example in the browser detection You see

if (IsMac && IsExplorer) location.href='whereeverto.html';

Detects whether a Macintosch with IE is used if so it goes to whatever.html because IE on the Mac has no way of detecting Flash.

Whatelse don't You understand?

just let me know and i'll help You...it's not that hard at all...


0
cavacaspAuthor Commented:
OK everything else looks good.  I'm pretty sure I understand the rest of it, so post an answer and I'll accept it.
0
DreamMasterCommented:
ok...here goes!

thanks!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DreamMasterCommented:
Yippie!!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.