Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #41206

Re: Obtaining the DOM tree for a *.htm file on a local disc?

From Arno Welzel <usenet@arnowelzel.de>
Newsgroups comp.lang.javascript
Subject Re: Obtaining the DOM tree for a *.htm file on a local disc?
Date 2023-02-19 00:33 +0100
Message-ID <k5d5j5Ft752U1@mid.individual.net> (permalink)
References <7cb3d7c8-74e8-49d2-ba7d-ab6df813f0c1n@googlegroups.com>

Show all headers | View raw


John Stockton, 2023-02-17 00:25:

> As feared,  MS IE 11 is now not available in Windows 10.  I do have a

Not, not "as feared" - this is a good thing, since IE is a mess for
security.

> work-round - I have a Windows XP PC with internet connection removed
> and with several older browsers, and I would transfer files via a USB
> memory stick. But that's not nearly as convenient as calling IE 11
> from the batch file that I am running.

Then call another browser from the batch file. There are many alternatives.

> Is there a readily-available function which can be called from
> JavaScript running in a normal modern browser which, given as an
> argument the name (relative to the current directory, or maybe
> absolute) of an HTML file, will return a reference to the parsed DOM
> tree of the BODY of the HTML, including the Links, Anchors, etc.
> arrays?

See <https://developer.mozilla.org/en-US/docs/Web/API/DOMParser>.

The problem is, that you may not be able to read the existing HTML file
into a string for security reasons since JavaScript in a browser is not
allowed to read local files on your computer.

However using Node.js you may just to that - then you would not even
need a browser to do that:

<https://www.npmjs.com/package/jsdom>


-- 
Arno Welzel
https://arnowelzel.de

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Obtaining the DOM tree for a *.htm file on a local disc? John Stockton <dr.j.r.stockton@gmail.com> - 2023-02-16 15:25 -0800
  Re: Obtaining the DOM tree for a *.htm file on a local disc? Dr.Kral@nyc.rr.com - 2023-02-16 19:46 -0500
    Re: Obtaining the DOM tree for a *.htm file on a local disc? Ezimene nimi Teine nimi <yyyyyeeeee00000@writeme.com> - 2023-03-06 03:17 -0800
  Re: Obtaining the DOM tree for a *.htm file on a local disc? Jon Ribbens <jon+usenet@unequivocal.eu> - 2023-02-17 01:06 +0000
  Re: Obtaining the DOM tree for a *.htm file on a local disc? JJ <jj4public@outlook.com> - 2023-02-17 08:34 +0700
  Re: Obtaining the DOM tree for a *.htm file on a local disc? "Jš•’š•žš•–š•¤ š•‚š•šš•£š•œ" <noneya.invalid@gmail.com> - 2023-02-17 15:13 +0000
    Re: Obtaining the DOM tree for a *.htm file on a local disc? K <techfan55555@hotmail.com> - 2023-03-11 01:59 -0800
  Re: Obtaining the DOM tree for a *.htm file on a local disc? Arno Welzel <usenet@arnowelzel.de> - 2023-02-19 00:33 +0100
  Re: Obtaining the DOM tree for a *.htm file on a local disc? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2023-02-21 22:13 +0100
  Re: Obtaining the DOM tree for a *.htm file on a local disc? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2023-02-21 22:15 +0100
    Re: Obtaining the DOM tree for a *.htm file on a local disc? Arno Welzel <usenet@arnowelzel.de> - 2023-03-09 03:06 +0100
  Re: Obtaining the DOM tree for a *.htm file on a local disc? John Stockton <dr.j.r.stockton@gmail.com> - 2023-03-04 13:36 -0800
    Re: Obtaining the DOM tree for a *.htm file on a local disc? JJ <jj4public@outlook.com> - 2023-03-05 23:05 +0700
      Re: Obtaining the DOM tree for a *.htm file on a local disc? John Stockton <dr.j.r.stockton@gmail.com> - 2023-03-05 15:26 -0800

csiph-web