A lot has changed since the code you are trying to upgrade was created. Local Storage now exists and to download a file; (Use case somebody may need to save it for using it locally) a download attrib is added to the anchor html tag. The file needs to be made into a URL-Blob
<a id="download" download="example.png">
<button type="button" onClick="download()" class="UI">Download</button>
</a>
<script>
function download() {
var download = document.getElementById("download");
var image = document.getElementById("meme").toDataURL("image/png").replace("image/png", "image/octet-stream");
download.setAttribute("href", image);
}
</script>
I would migrate to local-storage or IndexedDB API.
There is no drop in replacement for the activeX. because of security issues.
Major Differences
ActiveX allowed javascript to access a file to read or write, including being able to overwrite itself, anywhere on the hard drive.
HTML5 Allows reading and writting to localdata and several API for data including IndexDB. But file access is limited to what the user specifically uploads or for downloading into the download directory.
A Javascript WIKI page that replaces itself is no longer possible if you want it to overwrite itself. A Javascript WIKI page is possible using the IndexDB. Downloading the content is possible but limited for security reasons.