I develop a mobile app using phonegap. I have two file html (splash.html , index.html). So, I'd like that the app start with splash.html and after X seconds, change page to index.html.
How can I do this using javascript?
I develop a mobile app using phonegap. I have two file html (splash.html , index.html). So, I'd like that the app start with splash.html and after X seconds, change page to index.html.
How can I do this using javascript?
With JavaScript:
setTimeout(function() {
window.location.href = 'index.html';
}, 2000);
Without JavaScript:
<head>
<!-- ... -->
<meta http-equiv="refresh" content="2; url=index.html">
</head>
try this:
function delay(){
setTimeout(function(){
window.location.href='index.html'
},5000);}
You can perform this task only using HTML redirection meta tag like following :
<meta http-equiv="refresh" content="5; url=http://yoursite.com/">
The fact that I didn't precised any file after your site absolute URL is because the default file are loaded, and index.html
is a default file.
function delay(){
setTimeout(function(){
window.location.href='index.html'
},5000);}