| Summary: | history.back() does not restore scroll position | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Christian Taylor <christianbtaylor> |
| Component: | History | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED INVALID | ||
| Severity: | Normal | CC: | beidson, cdumez, simon.fraser, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari 16 | ||
| Hardware: | Mac (Intel) | ||
| OS: | macOS 13 | ||
|
Description
Christian Taylor
2023-10-03 08:04:56 PDT
Do you have an example of a page that shows this bug? Ah, I put together a demo and found an explanation. My link markup looked like this: `<a href="/previous" onclick="history.back()">Back</a>` I realized `back()` is asynchronous so the `href` is being followed as though the link were clicked. If I change the `onclick` to `event.preventDefault();history.back()` things work as I would expect. I was thrown off because `onclick="history.back()"` works in FireFox without needing the `preventDefault()`. I think this report can be closed. Thanks for letting me rubber duck this issue. Thank you for checking. |