Skip to content

Add possibility to prevent navigation away from current domain or page #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JulianGlueck
Copy link
Contributor

@JulianGlueck JulianGlueck commented Aug 22, 2025

This PR allows to restrict navigation within a window so that the user cannot navigate away from the current domain or page.

When implementing kiosk-type applications, you may want to give users access to certain pages or domains that are not directly under your control. In such cases, users may be able to navigate away from the page they are viewing, which is often undesirable.

This PR introduces two new methods on the Window facade which allow you to restrict in-window navigation. preventLeaveDomain would allow the user to navigate within the original host name. preventLeavePage would restrict any navigation (except anchors or URL parameters).

Electron PR: NativePHP/electron#250

@JulianGlueck
Copy link
Contributor Author

@SRWieZ @gwleuverink I am not entirely sure with this PR and would like to know your thoughts on it.
Do you think this functionality should be integrated into NativePHP? Do you see a better way how this could be implemented?
Any feedback on this would be highly appreciated. 🙂

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.

1 participant