Black Lives Matter. Please consider donating to Black Girls Code today.

Disable back button in app

How can i disable user to not to go back to dashboard without again logging in even if he presses back button in Chrome/IE.

Not sure you can do this, but it might be easier to detect url changes, and based on current url, route to your login page. See https://dash.plot.ly/urls for more info and examples.

Also, if you found a way to do this in Chrome/IE, would the same method work for Firefox, Moziilla, etc?

1 Like

If this is not possible then Can i close My IE or Chrome once I click logout button, please help.

Possibly…the following may work but it’s untested. Unfortunately, the python webbrowswer module does not have a close() method.

import time
import subprocess

# Store this, possibly in a dcc.Store component
web_process = subprocess.Popen(["google", "http://www.yourwebsite"])

# When logout button click detected, try this..
web_process.kill()
1 Like