()
| 346 | // of each client navigation in history.state, which the referrer (set once |
| 347 | // per document) cannot tell after the first in-app move. |
| 348 | export const canGoBackInApp = (): boolean => { |
| 349 | const { history } = globalThis; |
| 350 | if (!history || history.length <= 1) { |
| 351 | return false; |
| 352 | } |
| 353 | if (readStack().pointer > 0) { |
| 354 | return true; |
| 355 | } |
| 356 | const idx = (history.state as { idx?: number } | null)?.idx ?? 0; |
| 357 | |
| 358 | return idx > 0 || isSameSiteReferrer() || isDevelopment; |
| 359 | }; |
| 360 | |
| 361 | // One back for every leaf: the previous entry when it is ours, otherwise |
| 362 | // the root that owns the page, so a deep link always has a way up. |
no test coverage detected