I need to redirect to specific url after 5 seconds after putting an error message. First i have used Javascript as below.
document.ready(window.setTimeout(location.href = "https://www.google.co.in",5000));
But it is not waiting for 5 seconds. Than I searched the issue in google than come to know that "document.ready()" is invoked when document is loaded at DOM, not at web browser.
Than i have used window.load() function of jQuery but still i am not getting what i want.
$(window).load(function() {
window.setTimeout(window.location.href = "https://www.google.co.in",5000);
});
Can anyone please let me know how exactly i need to do to wait for 5 seconds.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…