- Pass the AJAX referer for all AJAX requests.
- Switch to synchronous requests. - All location changes go through the setLocation method. - Switch to using history.pushState. - AJAX middleware inserts AJAX referer as the request HTTP_REFERER. Signed-off-by: Eric Riggs <ericriggs42@gmail.com>
This commit is contained in:
committed by
Roberto Rosario
parent
f3f4dcd84a
commit
3be28131c9
@@ -5,6 +5,14 @@ from django.http import HttpResponseRedirect
|
||||
|
||||
|
||||
class AjaxRedirect(object):
|
||||
def process_request(self, request):
|
||||
ajax_referer = request.META.get('HTTP_X_ALT_REFERER')
|
||||
|
||||
if ajax_referer:
|
||||
request.META['HTTP_REFERER'] = ajax_referer
|
||||
|
||||
return None
|
||||
|
||||
def process_response(self, request, response):
|
||||
if request.is_ajax():
|
||||
if type(response) == HttpResponseRedirect:
|
||||
|
||||
Reference in New Issue
Block a user