Is it possible to open a new window when accessing a PHP page through the address bar without using target="_blank"?

When accessing a PHP page through the address bar, it is not possible to open a new window without using target="_blank" directly in the HTML code. However, you can use JavaScript to achieve this functionality by detecting if the page is being accessed directly and then opening a new window using window.open() method.

<?php
echo '<script>';
echo 'if(window.location.href === window.location.origin + window.location.pathname) {';
echo 'window.open("new_page.php", "_blank");';
echo '}';
echo '</script>';
?>