Reading a local file from an HTML page

Giganews Newsgroups
Subject: Reading a local file from an HTML page
Posted by:  dr.j.r.stockt…
Date: Thu, 2 Apr 2020

I currently have, in a HTML page

<iframe class=FYL ID=Iframe style="width:99%; height:270px;">

Fram = document.getElementById("Iframe")

function DiryToIframe(Diry) {
  Fram.onload = TimeOut ? DummyF : ReadDiryFromFram
  Fram.src = Diry
  if (TimeOut) setTimeout(ReadDiryFromFram, TimeOut)

and that function call would, in several browsers, put the
contents of the file given by Diry, on the same computer, into
the above iframe element, and I could then do

  var DIR = Fram.contentDocument.body
  DIR = DIR.textContent || DIR.innerText // Is latter needed? Yes, IE8

and the variable DIR would then contain the contents of file

That now only(?) works in Internet Explorer.

How do I set about doing that in all up-to-date browsers, disregarding
IE11 and current Edge, but including the imminent new Edge?

The whole thing must operate without user intervention, browsing
for a file name, even if the full name were known exactly, would
be intolerable.

Currently, I would be sufficiently sure that the file Diry exists;
but subsequently I will want to know whether the file does exist
before/after attempting to read it.

  (c) John Stockton, near London, UK.  Using Google Groups.          |
Mail: J.R."""""""" - or as Reply-To, if any.            |