defunkt / jquery-pjax

pushState + ajax = pjax
https://pjax.herokuapp.com
MIT License
16.74k stars 1.97k forks source link

How to cancel/abort ongoing request? #716

Closed fregante closed 1 year ago

fregante commented 5 years ago

Current

  1. Click pjaxed link
  2. Change your mind
  3. Can't do anything, linked page keeps loading
  4. When loaded, go back

Desired

  1. Click pjaxed link
  2. Change your mind
  3. Press esc, loading stops

There doesn't seem to be a way to stop a request that's already in progress, is there?

Ideally it would be something like $.pjax.stop or $(document).trigger('pjax:cancel') but maybe someone knows of an existing hack to abort it.

Requested in: https://github.com/sindresorhus/refined-github/issues/2118