I redirect the (login) page to either admin or guest page based on the input
the code work prefect through the VS live server but don't work through clicking the login.index in the folder.
function auth(event) {
event.preventDefault();
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if (username === "admin" && password === "67890") {
window.location.replace("/admin.html");
} else if (username === "guest" && password === "123456"){
window.location.replace("/guest.html");
} else {
Swal.fire({
title: 'Error!',
text: 'try again',
icon: 'error',
confirmButtonText: 'OK'
});
return;
}
}