Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX works locally but not from server

Status
Not open for further replies.

highpeak

Programmer
Aug 27, 2009
2
0
0
GB
I am developing a web application in perl that will require a test of the username as read from the Windows environment table - which I understand can only be achieved with ActiveX in Javascript.

So I knocked up a trivial test to see if I can read it - which works fine when I run it locally (in IE of course) ... but when I upload to the server and try to run it, doesn't do anything.

Am I missing something trivial here?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<html>
<head>
<title>Test JS-ActiveX</title>
</head>
<body>
<p>The Environment Variable for Username</p>

<SCRIPT type="text/javascript">
var wshshell=new ActiveXObject("wscript.shell");
var uname=wshshell.ExpandEnvironmentStrings("%username%");
alert(uname)
</SCRIPT>

</body>
</html>

Many Thanks
 
Looks like security constraints are preventing it to run.

Add the server to your trusted sites and use a Custom level that will allow unsigned script to run

Cheers,
Dian
 
Thanks for the replies,

I have looked at security settings in IE and loosened it to be as open as possible - including my server as a trusted site etc - but still it doesn't run the ActiveX in my html. It doesn't even ASK if it should run it (as it does when I run the same html file locally from Drive C:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top