|
|
|
|
|
by spotman
3560 days ago
|
|
> Today, the only option for ensuring an XHR request is made when the user re-visits a page via the back button is to (1) add an unload handler then (2) use cache busting. I'm sure there is exceptions, but in general, the last thing I want my browser to do when i press back, is to start making requests. I expect the requests to have been already made. |
|
My daily use case for this is Github Issues. Simple repro: Click an issue, make a change, press back.
Now the list view is out of date and doesn't show my changes. So I have to refresh.
I think a background XHR request is the best approach (until browsers fix this issue for real). On page load: pull latest from server (if network is down, then no-op). If no changes, then don't change. If there are changes then replace inline without a new page reload.