JS open new tab and close current

0

How can I open a new tab in php and close the current one?

I tried to use this error code 500 on the server

redirect.php

echo "</script>window.open(https://google.com, "_blank");</script>";
echo "</script>window.close();</script>";

Could anyone help me?

    
asked by anonymous 15.08.2017 / 19:26

1 answer

0

Use single quotes ( ' ) or escape character ( \ ) inside the string. Here is the code:

echo "</script>window.open(https://google.com, '_blank');</script>";
echo "</script>window.close();</script>";

OU

echo "</script>window.open(https://google.com, \"_blank\");</script>";
echo "</script>window.close();</script>";
    
16.08.2017 / 00:55