Reputation: 83
What I would like to do is to open a new link after setting a timer of 5 seconds on my "thank you" page. What I currently have right now is that the link that should be opened redirects on the same page. Is it possible to do this? What I was planning is to redirect the "thank you" page I have on my homepage while the new tab to be opened will be redirected to an external link. Thanks in advance. I've read solutions like the window.open but I think it isn't the one I'm looking for and most of the searches I encounter says that it doesn't allow it since it is treated as a "popup". Here is what I have now.
$(function () {
setTimeout(function () {
window.location = $('#redirect-url').attr('data-redirect-url');
}, 5000)
})
Upvotes: 0
Views: 875
Reputation: 6516
try this:
$(function () {
setTimeout(function () {
window.location = $('#redirect-url').attr('href','data-redirect-url');
}, 5000)
})
The .attr requires two parameters (attribute, value to that attribute)
EDIT
to open a new window, i know just this:
window.open('pageIWant.html', '_blank');
But it can really be treated as a popup by some browsers
Upvotes: 1