1
I have a problem and do not know how to solve, I am creating a system that when you click on a link the browser opens a new window.
As in this example:
<a href="link" target="_blank">Veja esse vídeo</a>
When the user enters the link he is directed to a new window in the browser and a cookie is set in case the user goes back to the previous page it is different.
As in the example below:
if(isset($_COOKIE['riu'])):
header('Location: ../riu.php');
endif;
But for this code to work the page needs to be updated to recognize the cookie and redirect the user to another page.
So what I want is that when the user enters the link that opens the video in another window, the link page is updated so that he runs the cookie script in php and redirects to the page "riu.php".
I’ve tried the second code:
<a href="link" target="_blank" onclick="Location.reload()">Veja esse vídeo</a>
But as shown above the page is refreshed without opening a new window.
I didn’t quite understand your need, you want to open the new page, set the cookie, and then want to that one page that arrow the cookie update, or the previous one that the user was on?
– andre_luiss
I want the previous page the user was on to be updated at the time the user enters the link that will open a new window.
– Mauricio Santos