examples/06-FromFile.ps1

# 06 - From a file: keep the page in its own .html file; openUrl links open in the default browser.
if (-not (Get-Command Show-NativeWebView -ErrorAction Ignore)) { Import-Module NativeWebView -ErrorAction Stop }

Show-NativeWebView -Path (Join-Path $PSScriptRoot "page.html") -Title "From a file" -Width 600 -Height 260 -OnMessage {
    param($Message, $Window)
    if (($Message | ConvertFrom-Json).action -eq "close") { $Window.Close() }
}