I have a page that relies on multiple partial refreshes for user interaction. Rather than implementing a session keep alive mechanism, I am interested in detecting error responses from these partial refreshes to alert the user of their expired session or the need to refresh the page. Once the user acknowledges the alert, I want to automatically trigger a window location reload. This process should be triggered by the user's attempt at a partial refresh and handled purely through client-side JavaScript.
By examining Chrome DevTools, I have observed that the partial refresh is represented as a POST request, which returns the refreshed area of the HTML along with the necessary client-side JavaScript functions. Additionally, I am aware that Dojo 1.6 has documentation related to error handling in dojo.xhr (specifically POST and GET) requests, allowing me to define a function for error handling. However, I am currently unsure of how to integrate this function into my dojo.xhrPost requests.
After reviewing this XSnippet titled "Cache Prevention for Dojo xhr requests", which demonstrates adding the preventCache option to dojo.xhr requests, I believe this is the correct approach. My challenge lies in implementing this solution effectively. Unfortunately, the provided link to the original source () is not functioning for me.
- I am uncertain about utilizing the same argument, arguments[1], mentioned in the referenced XSnippet, or determining the optimal position for arguments.
- Additionally, I am unsure if I need to specify this further for dojo.xhrPost events, or if using dojo.xhr alone is sufficient for this purpose.
I would greatly appreciate insights from more experienced individuals on this matter.