Skip to content

Instantly share code, notes, and snippets.


Mike Francis mjfusa

  • Microsoft
  • Issaquah, WA
View GitHub Profile
mjfusa / SaveToFileEdgeHTML.htm
Last active Jan 29, 2020
EdgeHTML PWA Save to File
View SaveToFileEdgeHTML.htm
In EdgeHTML / PWA downloading content by creating a download link on the fly and calling Click (traditional method) does not work.
TL;DR: See below for an implementation of the file download for EdgeHTML / PWA.
Longer explanation:
When running with the Spartan WebView as a HWA (Hosted Web App) or PWA MS Store, you’re running inside a UWP container with the associated security restriction. This has 2 implications:
• msSaveOrOpenBlob is not defined in this execution context for security reasons
• you can’t download directly a file on the file system using the + approach
mjfusa / FindPackageForUser.cs
Created Nov 19, 2019
Detect if MS Store app is installed
View FindPackageForUser.cs
// Companion to:
public static bool IsAppAlreadyInstalled(string FullPackageFamilyName)
var oPkgManager = new PackageManager();
bool result = false;
//If 1st parameter is string.Empty, the packages are retrieved for the current user.
Package oPkg = oPkgManager.FindPackageForUser(string.Empty, FullPackageFamilyName);
result = oPkg != null;
mjfusa / fileSaveSpartanPWA.htm
Created Oct 25, 2019
File Save from (Spartan) Edge PWA
View fileSaveSpartanPWA.htm
function saveBlob (blob, fileName) {
var a = document.createElement("a");
document.body.appendChild(a); = "display: none";
var url = window.URL.createObjectURL(blob);
a.href = url; = fileName;;
mjfusa / installchoco.cmd
Last active Dec 5, 2018
Chocolatey Install for new PC
View installchoco.cmd
if '%errorlevel%' == '0' ( goto continue
) else ( powershell "saps -filepath %0 -verb runas" >nul 2>&1)
exit /b
cd %~dp0
powershell Set-ExecutionPolicy bypass -force
powershell -f setpath.ps1
powershell Invoke-Expression ((New-Object System.Net.WebClient).DownloadString(''))
You can’t perform that action at this time.