I have this code right here:
<html>
<body style="color:white;background-color:#222222">
<center>
<br>
<input type="text" id="username"> Username</input>
<br>
<input type="text" id="password"> Password</input>
<br><br>
<button onclick="test()">Submit</button>
<p id="url"/>
<script type="text/javascript">
function test(){
var userInput = document.getElementById("username").value;
var userPass = document.getElementById("password").value;
document.getElementById("url").innerHTML = encodeURI('http://'+userInput+':'+userPass+'@'+window.location.hostname+':81/Home/');
}
</script>
</center>
</body>
</html>
It outputs an url that works. It logs me into my password-protected folders when I specify the right password. Only problem, I want the "Submit" button to automaticly redirect me to the specified page instead of showing me the url.
I tried everything. Please help. Thanks.
Please check this:
function test(){
var userInput = document.getElementById("username").value;
var userPass = document.getElementById("password").value;
location.href = encodeURI('http://'+userInput+':'+userPass+'@'+window.location.hostname+':81/Home/');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With