Exit Browser - Php

How to exit browser using php code?

Snippet Code

Rate this page :
  [ 0 votes]

PHP is executed at the server-side and it cannot perform client side actions. By using javascript code in php, we can open or close browser tabs.

<?php if(isset($_POST['btnclose'])) { closeWin(); } ?> <form action='' method='post'> <input type="submit" value="Close" name='btnclose'/> </form> <?php function closeWin() { echo "<script> var win= window.open('about:blank', '_self'); win.close(); </script>"; } ?>


Ask Questions

Ask Question