function getWindowsUserName()
{
var WinNetwork = new ActiveXObject("WScript.Network");
var urlToSite = "http://localhost/index.php?nph-psf=0&HOSTID=AD&ALIAS=" + WinNetwork.UserName;
window.frames["psyncLink"].src = "http://localhost/index.php?nph-psf=0&HOSTID=AD&ALIAS=" + WinNetwork.UserName;
return;
}
I am trying to make the frame load the urlToSite
<body onload="getWindowsUserName()">
<frameset cols="300px, *">
<frame src="topo1.htm" name="topo" id="topo" application="yes" />
<frame src="topo1.htm" name="psyncLink" id="psyncLink" application="yes" />
</frameset>
</body>
Actually now I am just getting a blank page. If i visit the same site in IE and manually type the username (case is not sensitive) then the page loads in IE. Therefore I think it’s something in the code thats the issue
<html>
<head>
<title>AIDS (Automated ID System)</title>
<HTA:APPLICATION
id="frames"
border="thin"
caption="yes"
icon="http://www.google.com/favicon.ico"
showintaskbar="yes"
singleinstance="yes"
sysmenu="yes"
navigable="yes"
contextmenu="no"
innerborder="no"
scroll="auto"
scrollflat="yes"
selection="yes"
windowstate="normal" />
<script language="javascript" type="text/javascript">
function getWindowsUserName()
{
var WinNetwork = new ActiveXObject("WScript.Network");
var urlToSite = createCustomURL(WinNetwork.UserName);
document.getElementById("psyncLink").src = urlToSite;
}
function createCustomURL(userName)
{
var customURL = "http://localhost/index.php?nph-psf=0&HOSTID=AD&ALIAS=" + userName;
return customURL;
}
</script>
</head>
<body onload="getWindowsUserName()">
<frameset cols="300px, *">
<frame src="topo1.htm" name="topo" id="topo" application="yes" />
<frame src="topo1.htm" name="psyncLink" id="psyncLink" application="yes" />
</frameset>
</body>
</html>
Though nested
framesetinbodyis not allowed, in “old-days”bodyelement was included afterframesetfor those browsers which didn’t support frames. This still works in IE9 Standards -mode, but then you can’t see frames.To execute
getWindowsUserName()after the page has been loaded, you can do something like this:or maybe move
getWindowsUserName()to topo1.htm.More info of
framesetin MSDN