Setting `window.location` from JavaScript breaks the pagination

Open
#125 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@mickael-menu is already working on this.

Since Jul 17, 2026.

  • #868 by @mickael-menu — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, swift
Domain
mobile-dev

Research direction

Start by reading the navigator’s handling of web view navigation and the readingOrder, then reproduce the behavior with the linked test EPUB. Done means JavaScript navigation to a readingOrder href updates pagination, while navigation to an external URL does not change the current location.

Written by the indexing model from the issue text.

Description

Currently, if a publication uses JavaScript to set window.location, the current web view contents is replaced but the pagination view is not updated, so the current chapter basically disappears.

Instead, the navigator should handle setting window.location this way:

  • If the href is part of the readingOrder, then treat the move as a jump to another location and update the pagination accordingly.
  • If the href is an external URL, treat it as a click on an external link and prevent changing the current location.

A test EPUB is available here: https://github.com/JayPanoz/architecture/tree/touch-handling/misc/touch-handling

Dominant language
Swift
Stars
557
Forks
249
Avg merge
3h 52m
Merged PRs (30d)
19

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from readium/swift-toolkit

All issues in readium/swift-toolkit

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.