File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
resources/views/docs/desktop/1/the-basics Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -394,6 +394,28 @@ Window::open()
394394
395395This 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 that is not under your control (such as external websites), you may want to
400+ restrict the user's navigation options. NativePHP provides two handy methods for this on the ` Window ` facade:
401+
402+ ``` php
403+ Window::open()
404+ ->url('https://nativephp.com/')
405+ ->preventLeaveDomain();
406+
407+ Window::open()
408+ ->url('https://laravel-news.com/bifrost')
409+ ->preventLeavePage();
410+ ```
411+
412+ The ` preventLeaveDomain() ` method allows navigation within the same domain but blocks any attempt to navigate away to a
413+ different domain, scheme or port.
414+
415+ With ` preventLeavePage() ` you can strictly confine the user to the initially rendered page. Any attempt to navigate to a
416+ different path (even within the same domain) will be blocked. However, in-page navigation via anchors (e.g. "#section")
417+ and updates to the query string remain permitted.
418+
397419#### Preventing new windows from popping up
398420
399421By default, Electron allows additional windows to be opened from a window that was previously opened programmatically.
You can’t perform that action at this time.
0 commit comments