I'm trying to open another html file or url various ways but non of them is working.
location.href = 'new_url';
location.replace('https://www.javascripttutorial.net/');
location.assign('https://www.javascripttutorial.net/');
So, I have a function when body loads it checks if cookies 'username' and 'password' are empty or are missing. That trigers an alert and then after I click on OK button on alert popup it should redirect but it doesn't.
Alert pops up so code works but when I press blue OK button it doesn't redirect
Help please?
Part of my JS code that i have problems with
function check_cookie(){
if ((getCookie('username') == null) || (getCookie('password') == null) || (getCookie('username') == "") || (getCookie('password') == "")){
alert('Session Expired!');
location.assign("https://stackoverflow.com/questions/503093/how-do-i-redirect-to-another-webpage");
return ;
}