I want to build a page that displays html for a short while and then redirects the user to another URL without opening a new window. How can this be done quickly in Jquery?
我想构建一个显示html一段时间的页面,然后将用户重定向到另一个URL而不打开新窗口。如何在Jquery中快速完成?
5 个解决方案
#1
3
Doesn't need javascript, just add the meta tag in the head:
不需要javascript,只需在头部添加元标记:
// for 5 seconds
<meta http-equiv="refresh" content="5; url=http://www.example.com/" />
#2
6
<script type="text/javascript">
window.onload = function() {
setTimeout(function() {
window.location = "your link";
}, 5000);
};
</script>
After 5 second, it will redirect. replace"your link" with the link you want.
5秒后,它将重定向。将“您的链接”替换为您想要的链接。
Hope it helps.
希望能帮助到你。
#3
0
Try this,
// you can use jquery document ready function to call your code after DOM ready
$(document).ready(function(){
setTimeout(function(){
window.open('your url to open');
},5000);// after 5 seconds
});
#4
0
If you're not wanting to open the URL in a new window use window.location.href = xx
如果您不想在新窗口中打开URL,请使用window.location.href = xx
setTimeout(function(){
window.location.href = 'http://www.google.com';
},5000);// after 5 seconds
#5
0
Try this
setTimeout(function() {
window.location = "new url";
}, 5000);
#1
3
Doesn't need javascript, just add the meta tag in the head:
不需要javascript,只需在头部添加元标记:
// for 5 seconds
<meta http-equiv="refresh" content="5; url=http://www.example.com/" />
#2
6
<script type="text/javascript">
window.onload = function() {
setTimeout(function() {
window.location = "your link";
}, 5000);
};
</script>
After 5 second, it will redirect. replace"your link" with the link you want.
5秒后,它将重定向。将“您的链接”替换为您想要的链接。
Hope it helps.
希望能帮助到你。
#3
0
Try this,
// you can use jquery document ready function to call your code after DOM ready
$(document).ready(function(){
setTimeout(function(){
window.open('your url to open');
},5000);// after 5 seconds
});
#4
0
If you're not wanting to open the URL in a new window use window.location.href = xx
如果您不想在新窗口中打开URL,请使用window.location.href = xx
setTimeout(function(){
window.location.href = 'http://www.google.com';
},5000);// after 5 seconds
#5
0
Try this
setTimeout(function() {
window.location = "new url";
}, 5000);