Running Script on local Webserver

C

Christoph

The following script works fine on two Webservers in the internet, but it
doesn't work on my local Webserver (Xitami). I also tried the IIS, with the
same result - the script isn't forwarding me

<script language="JScript">
<!--
function Kontrolle()
{
var WshNetwork = new ActiveXObject("WScript.Network");
var vDomain = WshNetwork.UserDomain;

if(vDomain == "´TESTDOM")
{
location.href = "right.htm";
}
else
{
location.href = "wrong.htm";
}
}
//-->
</script>

It must be a problem with the WScript object, but I've no clue what to do

Christoph
 
G

Grant Wagner

Christoph said:
The following script works fine on two Webservers in the internet, but it
doesn't work on my local Webserver (Xitami). I also tried the IIS, with the
same result - the script isn't forwarding me

<script language="JScript">
<!--
function Kontrolle()
{
var WshNetwork = new ActiveXObject("WScript.Network");

This will cause a yellow ! in Internet Explorer. You can't create a
WScript.Network object in Internet Explorer downloaded from a web server.
Double-clicking the yellow ! will probably be something like "Automation server
can't create object".
var vDomain = WshNetwork.UserDomain;

if(vDomain == "´TESTDOM")
{
location.href = "right.htm";
}
else
{
location.href = "wrong.htm";
}
}
//-->
</script>

It must be a problem with the WScript object, but I've no clue what to do

You can't obtain information about what domain a Windows computer is connected
to using JavaScript running in Internet Explorer in the default security
environment. You would have to lower your security settings to dangerous levels
to allow the above script to run (alternatively you could add the site to your
Trusted Sites list and lower the settings there).
Christoph

--
| Grant Wagner <[email protected]>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
* http://www.mozilla.org/docs/web-developer/upgrade_2.html
 
C

Christoph

Grant Wagner said:
This will cause a yellow ! in Internet Explorer. You can't create a
WScript.Network object in Internet Explorer downloaded from a web server.
Double-clicking the yellow ! will probably be something like "Automation server
can't create object". do

You can't obtain information about what domain a Windows computer is connected
to using JavaScript running in Internet Explorer in the default security
environment. You would have to lower your security settings to dangerous levels
to allow the above script to run (alternatively you could add the site to your
Trusted Sites list and lower the settings there).

Sure I can create that object! As I said, it works on 2 webservers on
the internet, so it's just a problem with the configuration of my own
Webserver
The IE asks me, if I want to allow it, but it works!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top