Skip to content

Commit dbbcc2f

Browse files
committed
Add documentation for window navigation restriction
1 parent 83dae26 commit dbbcc2f

File tree

1 file changed

+23
-0
lines changed
  • resources/views/docs/desktop/1/the-basics

1 file changed

+23
-0
lines changed

resources/views/docs/desktop/1/the-basics/windows.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,29 @@ Window::open()
394394

395395
This is particularly useful for always-on-top utility windows or menubar applications that should not be visible in Mission Control.
396396

397+
### Restrict navigation within a window
398+
399+
When opening windows that display content outside your control that is not under your control (such as external
400+
websites), you may want to restrict the user's navigation options. NativePHP provides two handy methods for this on the
401+
`Window` facade:
402+
403+
```php
404+
Window::open()
405+
->url('https://nativephp.com/')
406+
->preventLeaveDomain();
407+
408+
Window::open()
409+
->url('https://laravel-news.com/bifrost')
410+
->preventLeavePage();
411+
```
412+
413+
The `preventLeaveDomain()` method allows navigation within the same domain but blocks any attempt to navigate away to a
414+
different domain, scheme or port.
415+
416+
With `preventLeavePage()` you can strictly confine the user to the initially rendered page. Any attempt to navigate to a
417+
different path (even within the same domain) will be blocked. However, in-page navigation via anchors (e.g. "#section")
418+
and updates to the query string remain permitted.
419+
397420
## Window Title Styles
398421

399422
### Default Title Style

0 commit comments

Comments
 (0)