0

I recently implemented a .htpasswd based login page and am trying to figure out a certain way I have in mind to close the browser window (because that is how I can reset the authentication so the user cannot log in again).

My idea is that once the user logs in and submits the information on the form they have to fill out, the submission of the form would trigger a script to close the browser window in 5 seconds. The user would be warned before hand that this will happen.

I'm not a pro coder when it comes to scripting, any ideas? I haven't found much information on this specific topic.

mateikav
  • 93
  • 3
  • 9
  • No matter how you do it with a script, remember that the users can bypass your system (exemple: disable Javascript or if the user has multiple tabs opened on their browser the browser may not clear login credentials from cache instantly). Maybe you should consider another authentication method. – Simon Arsenault Mar 10 '13 at 22:03

1 Answers1

1

With jquery/javascript you can use window.close()

An example using a button...

html

<button id="close">Close</button>

jquery

$(document).ready(function() {
    $('#close').click(function(){
        window.close();
    });
});

For further info...

lukeocom
  • 3,243
  • 3
  • 18
  • 30