Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38367
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: Reading a local file from an HTML page |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <4830286f-4484-49f8-9cda-9a4073ab6502@googlegroups.com> <b6ad961f-1dad-4bef-9db9-977a096f2b33@googlegroups.com> <2c9a81c5-d18c-4fc2-8df0-5524e03d5c21@googlegroups.com> |
| Date | 2020-04-04 12:17 +0200 |
| Message-ID | <XnsAB957D1A0137Beejj99@194.109.6.166> (permalink) |
dr.j.r.stockton@gmail.com wrote on 04 Apr 2020 in comp.lang.javascript:
> We did; but circumstances prevented immediate implementation, and I
> cannot now locate the answer.
Perhaps not directly applicable in your case,
but I bypass all same-origin annoyance by uploding
the html as a scripted string.
I make a second file [2nd.jshtml] enclosing the whole content in:
let secondFileContent = `xxxx`;
where xxxx is the content with newlines and all.
[NB: these `` are backticks!]
You would need to escape backticks ` to \`
in the text, but they probably are not there anyway,
and also escape ${ to \${.
You can easily do all this with a .bat file or with cscript/wscript.
Then the string is available in the main page by
<script src='2nd.jshtml'></script>
<script>
console.log(secondFileContent);
</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Reading a local file from an HTML page dr.j.r.stockton@gmail.com - 2020-04-02 13:29 -0700
Re: Reading a local file from an HTML page minajaich@gmail.com - 2020-04-02 18:59 -0700
Re: Reading a local file from an HTML page JJ <jj4public@vfemail.net> - 2020-04-03 20:18 +0700
Re: Reading a local file from an HTML page "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-04-03 10:57 -0700
Re: Reading a local file from an HTML page dr.j.r.stockton@gmail.com - 2020-04-03 15:24 -0700
Re: Reading a local file from an HTML page "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-04-03 17:11 -0700
Re: Reading a local file from an HTML page dr.j.r.stockton@gmail.com - 2020-04-04 05:41 -0700
Re: Reading a local file from an HTML page "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-04-04 12:17 +0200
Re: Reading a local file from an HTML page "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-04-06 17:01 -0700
Re: Reading a local file from an HTML page dr.j.r.stockton@gmail.com - 2020-04-13 12:11 -0700
Re: Reading a local file from an HTML page "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-04-14 10:04 -0700
csiph-web