-
-
Save DBremen/c4a61d8d890dc0ce5510de50fcc8e499 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Show-HTML ([string]$HTML){ | |
Add-Type –AssemblyName PresentationFramework | |
if(Test-Path $HTML -IsValid){ | |
$txt = Get-Content $HTML -Raw | |
$HTML = $txt | |
} | |
$HTML.Replace('<head>','<meta name="viewport" content="width=device-width, initial-scale=1"><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta http-equiv="Content-Type" content="text/html;charset=utf-8">') | |
[xml]$XAML = @' | |
<Window | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
Title="PowerShell HTML GUI" WindowStartupLocation="CenterScreen"> | |
<WebBrowser Name="WebBrowser"></WebBrowser> | |
</Window> | |
'@ | |
#Read XAML | |
$reader=(New-Object System.Xml.XmlNodeReader $xaml) | |
$Form=[Windows.Markup.XamlReader]::Load( $reader ) | |
$WebBrowser = $Form.FindName("WebBrowser") | |
$WebBrowser.NavigateToString($HTML) | |
$Form.ShowDialog() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment