Reload page on browser back button navigationUnverified
be4aec4 parent: 2707cd5 modified
internal/tmpl/base.html +6 -0 | @@ -310,6 +310,12 @@ | ||
| 310 | 310 | applyTheme(); |
| 311 | 311 | applyShape(); |
| 312 | 312 | |
| 313 | + // reload page when page restored from bfcache. | |
| 314 | + // useful for reloading article read/unread status. | |
| 315 | + window.addEventListener('pageshow', function(e) { | |
| 316 | + if (e.persisted) location.reload(); | |
| 317 | + }); | |
| 318 | + | |
| 313 | 319 | function closeAnnotate(el) { |
| 314 | 320 | var form = el.closest('.annotate-form'); |
| 315 | 321 | form.classList.add('hidden'); |
| @@ -310,6 +310,12 @@ | |||
| 310 | applyTheme(); | 310 | applyTheme(); |
| 311 | applyShape(); | 311 | applyShape(); |
| 312 | 312 | ||
| 313 | + // reload page when page restored from bfcache. | ||
| 314 | + // useful for reloading article read/unread status. | ||
| 315 | + window.addEventListener('pageshow', function(e) { | ||
| 316 | + if (e.persisted) location.reload(); | ||
| 317 | + }); | ||
| 318 | + | ||
| 313 | function closeAnnotate(el) { | 319 | function closeAnnotate(el) { |
| 314 | var form = el.closest('.annotate-form'); | 320 | var form = el.closest('.annotate-form'); |
| 315 | form.classList.add('hidden'); | 321 | form.classList.add('hidden'); |