I want to close the browser in laravel controller when I clicked the logout.I want to write java script window.close();
in controller(laravel 5.3).
public function logout(){
//Session::flush();
Auth::logout();
//return Redirect::route('close');
}
I created my page using master and child page structure.(ie) displayed child page in home page using yield('content') in sampleApp.blade.php(master page)
Latest browser versions do not allow any script to close a window that was not initially opened by the same script. This is a security precaution and you cannot do anything about that.
You can check Window.close()
documentation page to read more about it.
I suggest you follow the best practice, which is redirecting the user to home page after they log out.
(and of course you cannot close the browser from your controller)