From dbbcc2f5ba47cc6ada9b059dc75879e2a58970d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gl=C3=BCck?= Date: Wed, 3 Sep 2025 19:55:23 +0200 Subject: [PATCH 1/2] Add documentation for window navigation restriction --- .../docs/desktop/1/the-basics/windows.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/resources/views/docs/desktop/1/the-basics/windows.md b/resources/views/docs/desktop/1/the-basics/windows.md index 5dc737ea..996b4d3a 100644 --- a/resources/views/docs/desktop/1/the-basics/windows.md +++ b/resources/views/docs/desktop/1/the-basics/windows.md @@ -394,6 +394,29 @@ Window::open() This is particularly useful for always-on-top utility windows or menubar applications that should not be visible in Mission Control. +### Restrict navigation within a window + +When opening windows that display content outside your control that is not under your control (such as external +websites), you may want to restrict the user's navigation options. NativePHP provides two handy methods for this on the +`Window` facade: + +```php +Window::open() + ->url('https://nativephp.com/') + ->preventLeaveDomain(); + +Window::open() + ->url('https://laravel-news.com/bifrost') + ->preventLeavePage(); +``` + +The `preventLeaveDomain()` method allows navigation within the same domain but blocks any attempt to navigate away to a +different domain, scheme or port. + +With `preventLeavePage()` you can strictly confine the user to the initially rendered page. Any attempt to navigate to a +different path (even within the same domain) will be blocked. However, in-page navigation via anchors (e.g. "#section") +and updates to the query string remain permitted. + ## Window Title Styles ### Default Title Style From 6b209374c6deb50bc86ef131a6e70f32b3af097f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20Gl=C3=BCck?= Date: Wed, 3 Sep 2025 20:01:32 +0200 Subject: [PATCH 2/2] Fix typo --- resources/views/docs/desktop/1/the-basics/windows.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/resources/views/docs/desktop/1/the-basics/windows.md b/resources/views/docs/desktop/1/the-basics/windows.md index 996b4d3a..32560354 100644 --- a/resources/views/docs/desktop/1/the-basics/windows.md +++ b/resources/views/docs/desktop/1/the-basics/windows.md @@ -396,9 +396,8 @@ This is particularly useful for always-on-top utility windows or menubar applica ### Restrict navigation within a window -When opening windows that display content outside your control that is not under your control (such as external -websites), you may want to restrict the user's navigation options. NativePHP provides two handy methods for this on the -`Window` facade: +When opening windows that display content that is not under your control (such as external websites), you may want to +restrict the user's navigation options. NativePHP provides two handy methods for this on the `Window` facade: ```php Window::open()