For several years now, I've been using the Javascript function below to have Internet Explorer generate a username and password prompt by using ActiveX. Now that Internet Explorer is about to be retired, does anyone know how I can accomplish the same thing using Edge, which doesn't support ActiveX (or by using Firefox or Chrome or...)? Thanks to all who respond.
function PasswordBox( strIETitle ) {
objIE = new ActiveXObject( "InternetExplorer.Application" );
objIE.FullScreen = False;
objIE.AddressBar = False;
objIE.MenuBar = False;
objIE.StatusBar = False;
objIE.ToolBar = False;
objIE.RegisterAsDropTarget = False;
objIE.Navigate("about:blank");
strLoginID = strLocalUser;
do {
WScript.Sleep( 100 );
} while ( ! objIE.ReadyState == 4 );
objIE.document.parentWindow.resizeTo( 400, 200 + 70 );
objIE.document.parentWindow.moveTo(
objIE.document.parentWindow.screen.width / 2 - 200,
objIE.document.parentWindow.screen.height / 2 - 200 );
objIE.document.writeln( "<html>" );
objIE.document.writeln( "<head>" );
objIE.document.writeln( "<title>" + strIETitle + "</title>" );
objIE.document.writeln( "<style type='text/css'>" );
objIE.document.writeln( "<!--" );
objIE.document.writeln( ".fixed { font-family:courier new, monospace }" );
objIE.document.writeln( "-->" );
objIE.document.writeln( "</style>" );
objIE.document.writeln( "</head>" );
objIE.document.writeln( "<body bgcolor=Silver>" );
objIE.document.writeln( "<center>" );
objIE.document.writeln( "<form>" );
objIE.document.writeln( "<b>" + strIETitle + "</b><p>" );
objIE.document.writeln( "<table>" );
objIE.document.writeln( "<tr><td colspan=2 align=left>" );
objIE.document.writeln( "Enter your username and password:<br>" );
objIE.document.writeln( "</td></tr><tr><td valign=top>" );
objIE.document.writeln( "Username: " );
objIE.document.writeln( "</td><td>" );
objIE.document.writeln( "<input id='userid' size=20 class='fixed' " +
"value='" + strLoginID + "'>" );
objIE.document.writeln( "</td></tr><tr><td valign=top>" );
objIE.document.writeln( "Password: " );
objIE.document.writeln( "</td><td>" );
objIE.document.writeln( "<input type='password' id='passwd' size=20 class='fixed'><p>" );
objIE.document.writeln( "</td></tr>" );
objIE.document.writeln( "</table>" );
objIE.document.writeln( "<p>" );
objIE.document.writeln( "<input type='button' value='Submit' id='but0' " +
"onclick=\"submitted.value='DONE';\">" );
objIE.document.writeln( "<input type='hidden' id='submitted' value=''>" );
objIE.document.writeln( "</form>" );
objIE.document.writeln( "</center>" );
objIE.document.writeln( "</body>" );
objIE.document.writeln( "</html>" );
objIE.document.parentWindow.document.body.scroll="no";
objIE.document.parentWindow.document.body.style.borderStyle = "outset";
objIE.document.parentWindow.document.body.style.borderWidth = "3px";
objIE.Visible = True;
objIE.document.addEventListener( "keydown", keyHit, false );
objWShell.AppActivate( strIETitle );
objIE.document.getElementById( "passwd" ).focus();
blnPwdBoxWait = '';
try {
do {
WScript.Sleep( 100 );
if ( objIE.Visible && blnPwdBoxWait == '' ) {
blnPwdBoxWait = objIE.document.getElementById( "submitted" ).value;
}
} while ( blnPwdBoxWait == '' );
} catch( err ) {
WScript.Echo('ERROR: ' + err.message);
blnPwdBoxWait = 'DONE';
}
strLoginID = objIE.document.getElementById( "userid" ).value;
strPassword = objIE.document.getElementById( "passwd" ).value;
objIE.Visible = False;
objIE.Quit();
objIE = null;
return strPassword;
}