Skip to content

Prevent external links from replacing the slide deck - #104

Open
Gise23 wants to merge 1 commit into
beeware:mainfrom
Gise23:36-block-external-links
Open

Gise23 wants to merge 1 commit into
beeware:mainfrom
Gise23:36-block-external-links

Conversation

@Gise23

@Gise23 Gise23 commented Nov 7, 2026

Copy link
Copy Markdown

Both the slides and speaker-notes WebViews now have an on_navigation_starting handler that only allows navigation to URLs served by the deck. Navigation to any other URL is cancelled.

Testing

  • Tested on macOS in both the slides and speaker-notes windows.
  • Not covered on GTK/Linux, as Toga doesn't support on_navigation_starting there

Clicking an external link in a slide or the speaker notes navigated the window away from the presentation, with no way to get back.

Fixes #36

Question: With this change, clicking an external link does nothing. Would it be better to open blocked links in the system browser instead?

PR Checklist:

  • I will abide by the BeeWare Code of Conduct
  • I have read and have followed the CONTRIBUTING.md file
  • This PR was generated or assisted using an AI tool

Assisted-by: Claude Opus 5.5

@freakboy3742 freakboy3742 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! The approach you've taken here looks correct; the only suggestion I'd make would be that is_doc_url should be a method on the Deck, rather than a free-standing method.

@freakboy3742

Copy link
Copy Markdown
Member

As for your question about opening links in the system browser - if you can make that work, it definitely sounds preferable to silently swallowing the click. My only concern would be what happens when the app is in presentation mode... but I guess in presentation mode you don't have a cursor, so this might not be an issue? If you can confirm this isn't a problem in practice, and you can implement the "open in system browser" approach, then go for it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

External href links are death traps

2 participants