RR wrote:
I'm developing a web app and, for the user's convenience, I'd like to
display their local computer name (i.e. the name of the computer the browser
is running on).
I've looked very hard to find a script that will deliver this and I've also
tried some VBScript (which I know nothing about).
I found a script that did this:
var oShell = new ActiveXObject("Shell.Application");
then I thought to run
oShell.ShellExecute to echo %COMPUTERNAME%
But, I get a Permission Denied error.
How do I get the computer name? It's OK if the user has to grant permission
(I haven't found out how to get the Permission Denied to go away).
Thanks,
RR
var ax = new ActiveXObject("WScript.Network");
document.write(ax.UserName + '<br />');
document.write(ax.ComputerName + '<br />');
But you have to lower your security settings to dangerous and foolishly low
levels in the latest patched release of IE6SP1 to even get this to run.
If you insist on doing this, go to Tools -> Internet Options -> Security tab ->
Internet Zone -> Custom Level...
Change "Initialize and script ActiveX controls not marked as safe" to either
"Prompt" or "Enable"
A better choice might be:
Tools -> Internet Options -> Security tab -> Trusted sites Zone -> Sites...
Enter the domain name of the site you'd like the script to run from in the "Add
this Web site to the zone:" text box and click "Add". If the site is not https:,
you'll need to uncheck the "Require server verification (https:) for all sites
in this zone" checkbox before clicking "Add".
--
| Grant Wagner <gw*****@agricoreunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
*
http://www.mozilla.org/docs/web-deve...upgrade_2.html