开发者

How to skip interstitial in a django view if a user hits the back button?

I have an application with an interstitial page to hold the user while an intensive operation runs in the background (takes anywhere from 30 secs to 1 minute). Once the operation is done, the user is redirected to the results page.

Once on the result page, typical user behavior is to hit the 'back' button to perform the operation on a different input set. However, the back button takes them to the interstitial, not the original form. The desired behavior is to go back to the original form, skipping the interstitial entirely. I'd like this to b开发者_开发百科e default behavior if the user goes to the interstitial page from anywhere but the original form.

I thought I could create this by using the @never_cache function decorator in my view for the interstitial, and logic based on request.META['HTTP_REFERER'], however the page doesn't respect these. The browser's back button still trumps this behavior.

Any ideas on how to solve this issue?


How do you keep the interstitial page from entering the flow? Eliminate it.

I'm only recently wrapping my head around AJAX, so wish I could give you a more concrete answer, but the general approach is to use something like jQuery to replace the contents of the form <div> after submission with a "hey, I'm working here" indication and then a load of the new page when ready.

jQuery very kindly appends a unique, junk parameter to certain requests to explicitly thwart caching of volatile pages.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜