I have a script which opens a new (child) window, while refreshing the parent page.
<script type="text/javascript">
function OpenWindow() {
window.open ('start_process.php', 'newwindow', config='height=670,
width=1400, toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, directories=no, status=no');
window.location = 'www.example.com';
}
</script>
However, this process is rather "blitz" --- it happens in the blink of an eye :)
I would like to add a time-delay to the second part of the process : the refreshing of the parent-page.
Meaning, once the child-window is opened, I would like a few seconds of delay BEFORE the parent-page is refreshed.
(Not sure if this is even possible, because I cannot find anything remotely similar online)
I know there are several timer-functions and scripts available. But, can I add a timer to this particular situation?
I tried doing this :
<script type="text/javascript">
function OpenWindow() {
window.open ('start_process.php', 'newwindow', config='height=670,
width=1400, toolbar=no, menubar=no, scrollbars=no, resizable=no,
location=no, directories=no, status=no');
window.location = ('www.example.com',2000);
}
</script>
But, it did not work;
You can use something like this:
setTimeout(function() {
window.location = 'www.example.com';
}, 2000);
This will redirect the browser to www.example.com
after 2 seconds.