Feature: Warn before leaving

Adds a warning before navigating away or closing the browser.