In my website, I need to open the page automatically after 5 seconds, I am using the following code, but my browser is showing POP-UP BLOCKED. Please let me know the solution for my query. Thanks in advance.
$(document).ready(function()
{
setTimeout(function(){
window.open("http://www.google.com")}, 5000);
});
Use this instead:
$(document).ready(function () {
setTimeout(function () {
window.location.href = "http://www.google.com"
}, 5000);
});
取消阻止浏览器弹出
function open_win() {
window.open("x.com");
setTimeout("window.open('y.com')",60000);
setTimeout("window.open('z.com')",120000);
}
This should open x.com then after one minute y.com and after two it should open z.com. If still there is a pop-up error, check this question's answer: Bypass popup blocker on window.open when JQuery event.preventDefault() is set .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.