WiX Custom Action in Javascript – How to make web requests?

I have a Custom Action in WiX (windows installer toolset) that is written in Javascript. What are my options to make web requests? As far as I know, fetch is a web api which is not accessible in the runtime provided by the windows installer. Is there a way to import third-party libraries?

Answer

Microsoft JScript (which is what is run in WiX custom actions) provides native web requests like this:

// Instantiate a WinHttpRequest object.
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");

WinHttpRequest can then be used similar to XMLHttpRequest.

see documentation here