Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render an HTML snippet without saving it to a file

I have a PowerShell command that returns an HTML snippet:

(Get-AzureResourceGroupGalleryTemplate -Identity Microsoft.WebSiteSQLDatabase.0.3.17-preview).description

enter image description here

Is there a way to easily render that snippet without first saving it to a file? e.g. perhaps throw it into a web browser?

like image 761
jamiet Avatar asked Mar 16 '23 20:03

jamiet


1 Answers

Create a new Internet Explorer instance and inject your HTML snippet into the body of a blank page:

$id   = 'Microsoft.WebSiteSQLDatabase.0.3.17-preview'
$html = (Get-AzureResourceGroupGalleryTemplate -Identity $id).description

$ie = New-Object -COM 'InternetExplorer.Application'

$ie.Navigate('about:blank')
do {
  Start-Sleep -Milliseconds 100
} until ($ie.ReadyState -eq 4)

$ie.Document.body.innerHTML = $html

$ie.Visible = $true
like image 124
Ansgar Wiechers Avatar answered Mar 23 '23 21:03

Ansgar Wiechers