I have an html page containing an href link to another page. Clicking this link will open up a new tab that asks for login credentials. I would like to replace the href with a javascript function that will authenticate the link with a hard-coded username-password and then open it in a new tab so that the user doesn't have to enter the credentials (not even once). The requirement here is that the user is not expected to know/remember the credentials for the new link.
<!DOCTYPE html>
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function Login() {
var link = "https://serverB";
-- Authenticate serverB and save cookie in broswer / save auth info
window.open(link);
-- window.open() should open the link without requiring another login
}
// End -->
</script>
</head>
<body>
<form name=login>
<input type=button onClick="Login()" name="button" value="Redirect to serverB">
</form>
</body>
</html>