Ignore click if window.onbeforeunload is set

If window.onbeforeunload is set, it’s likely that we aren’t able to
safely navigate with pjax.

This change helps prevent two issues:
1. user could inadvertently pjax away from unsaved changes without
triggering a confirmation dialog, and
2.  user could potentially trigger the confirmation dialog in the
wrong context if they navigate away from the current content with pjax
and then do a full page load.