1
How can I open a new guide on JavaScript
and close the current?
I tried using this code but error 500 on the server
redirect.php
echo "</script>window.open(https://google.com, "_blank");</script>";
echo "</script>window.close();</script>";
Could someone help me ?
This is not PHP, it’s Javascript.
– Sam
True, it was only a mistake
– Natanael Nicolas
New tabs should only be opened with the user’s click. This kind of practice of opening new tabs without user interaction is not advisable and most browsers understand how to pop-ups and block.
– Sam
And you need to escape by using double quotes on the content inside
echo
:echo "</script>window.open(\"https://google.com\", \"_blank\");</script>";
– Rafael Araújo