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


Groups > comp.lang.javascript > #38592 > unrolled thread

Re: alternate way?

Started byRobert Baer <robertbaer@localnet.com>
First post2020-07-24 00:08 -0700
Last post2020-07-25 00:57 +0200
Articles 14 — 7 participants

Back to article view | Back to comp.lang.javascript

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: alternate way? Robert Baer <robertbaer@localnet.com> - 2020-07-24 00:08 -0700
    Re: alternate way? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-07-24 09:45 +0200
      Re: alternate way? Robert Baer <robertbaer@localnet.com> - 2020-07-24 12:16 -0700
        Re: alternate way? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-07-25 14:42 +0200
          Re: alternate way? Richard Damon <Richard@Damon-Family.org> - 2020-07-25 20:20 -0400
          Re: alternate way? Robert Baer <robertbaer@localnet.com> - 2020-08-03 15:01 -0700
    Re: alternate way? JJ <jj4public@vfemail.net> - 2020-07-24 19:27 +0700
      Re: alternate way? Robert Baer <robertbaer@localnet.com> - 2020-07-24 12:21 -0700
        Re: alternate way? JJ <jj4public@vfemail.net> - 2020-07-25 20:06 +0700
          Re: alternate way? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-07-25 11:29 -0700
            Re: alternate way? JJ <jj4public@vfemail.net> - 2020-07-26 20:42 +0700
            Re: alternate way? Arno Welzel <usenet@arnowelzel.de> - 2020-08-04 04:38 +0200
              Re: alternate way? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-08-03 19:43 -0700
      Re: alternate way? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-07-25 00:57 +0200

#38592 — Re: alternate way?

FromRobert Baer <robertbaer@localnet.com>
Date2020-07-24 00:08 -0700
SubjectRe: alternate way?
Message-ID<wNvSG.170651$AN2.151955@fx46.iad>
JJ wrote:
> On Mon, 20 Jul 2020 16:36:01 -0700, Robert Baer wrote:
>>     I have some stupid ideas to use javascrpt to (incrementally) read and
>> parse an array.
>>
>>     The bad thing is that file is OUTSIDE any javascript function and i
>> see no way to do a generic? "capture"/read/access of data.
>>
>>     Ideas?
>>
>> Thanks
> 
> If the file is in the local computer, you can not use a web browser to fully
> automate the whole process. With a web browser, the user will need to
> manually select the file. i.e. user interaction is needed. This includes
> making the result of the process available to application outside of the web
> browser application.
> 
> I'd suggest using Node.js, HTML Application, or Windows Script Host. Or just
> the latter two if you don't want to download any additional software.
> 
   OK, scratch all of that bushwah.

   How about user picking out [from a selection] a "keyword' (which will 
be one word) and having a magic combination of simple HTML, CSS, and js 
to pass that onto the browser keyboard find function [as if one had done 
a <ctrl>f and then typed in that "keyword"]?

   Thanks

[toc] | [next] | [standalone]


#38593

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2020-07-24 09:45 +0200
Message-ID<XnsAC04634FA10Feejj99@194.109.6.166>
In reply to#38592
Robert Baer <robertbaer@localnet.com> wrote on 24 Jul 2020 in
comp.lang.javascript: 

> JJ wrote:
>> On Mon, 20 Jul 2020 16:36:01 -0700, Robert Baer wrote:
>>>     I have some stupid ideas to use javascrpt to (incrementally) read
>>>     and 
>>> parse an array.
>>>
>>>     The bad thing is that file is OUTSIDE any javascript function and
>>>     i 
>>> see no way to do a generic? "capture"/read/access of data.
>>>
>>>     Ideas?
>>>
>>> Thanks
>> 
>> If the file is in the local computer, you can not use a web browser to
>> fully automate the whole process. With a web browser, the user will
>> need to manually select the file. i.e. user interaction is needed. This
>> includes making the result of the process available to application
>> outside of the web browser application.
>> 
>> I'd suggest using Node.js, HTML Application, or Windows Script Host. Or
>> just the latter two if you don't want to download any additional
>> software. 
>> 
>    OK, scratch all of that bushwah.
> 
>    How about user picking out [from a selection] a "keyword' (which will
> be one word) and having a magic combination of simple HTML, CSS, and js 
> to pass that onto the browser keyboard find function [as if one had done
> a <ctrl>f and then typed in that "keyword"]?

"magic" exists only in your mind, and "alternate" reminds me of homeopathy.

A browser page, inclusive of on plage javascript, is not allowed to access 
local files on the client computer.

Perhaps you can explain what you really want? 



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#38598

FromRobert Baer <robertbaer@localnet.com>
Date2020-07-24 12:16 -0700
Message-ID<PsGSG.70970$bQ4.38498@fx04.iad>
In reply to#38593
Evertjan. wrote:
> Robert Baer <robertbaer@localnet.com> wrote on 24 Jul 2020 in
> comp.lang.javascript:
> 
>> JJ wrote:
>>> On Mon, 20 Jul 2020 16:36:01 -0700, Robert Baer wrote:
>>>>      I have some stupid ideas to use javascrpt to (incrementally) read
>>>>      and
>>>> parse an array.
>>>>
>>>>      The bad thing is that file is OUTSIDE any javascript function and
>>>>      i
>>>> see no way to do a generic? "capture"/read/access of data.
>>>>
>>>>      Ideas?
>>>>
>>>> Thanks
>>>
>>> If the file is in the local computer, you can not use a web browser to
>>> fully automate the whole process. With a web browser, the user will
>>> need to manually select the file. i.e. user interaction is needed. This
>>> includes making the result of the process available to application
>>> outside of the web browser application.
>>>
>>> I'd suggest using Node.js, HTML Application, or Windows Script Host. Or
>>> just the latter two if you don't want to download any additional
>>> software.
>>>
>>     OK, scratch all of that bushwah.
>>
>>     How about user picking out [from a selection] a "keyword' (which will
>> be one word) and having a magic combination of simple HTML, CSS, and js
>> to pass that onto the browser keyboard find function [as if one had done
>> a <ctrl>f and then typed in that "keyword"]?
> 
> "magic" exists only in your mind, and "alternate" reminds me of homeopathy.
> 
> A browser page, inclusive of on plage javascript, is not allowed to access
> local files on the client computer.
* Excuse me, even using WinXP IE8 which is so good it cannot find a 
grain of sand even while sitting on the Sahara desert does this as follows:
   eXplicitly URL a file (on your computer or whatever), while looking 
at the file, do a <ctrl>f ; see a browser find box and start typing a 
word; notice as typing that is highlighted. Select "highlight all" and a 
second color is used to highlight all other instances.

* Also works same way Win7 IE11, Firefox, etc.

> 
> Perhaps you can explain what you really want?
* I did.
   I want a program that will do exactly that without one having to 
press keys (the Ctrl key, the F key, tose comprising the "keyword").
   A calling program will pass the "keyword" to this one, and 
appropriate highlighting will show depending if (running now) the search 
previous/next arrows are used, or "highlight all" is used.

     Thanks

[toc] | [prev] | [next] | [standalone]


#38603

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2020-07-25 14:42 +0200
Message-ID<XnsAC0595A9F3454eejj99@194.109.6.166>
In reply to#38598
Robert Baer <robertbaer@localnet.com> wrote on 24 Jul 2020 in 
comp.lang.javascript:

>> A browser page, inclusive of on plage javascript, is not allowed to 
>> access local files on the client computer.

> * Excuse me,

Why should I?

> even using WinXP IE8 which is so good it cannot find a 
> grain of sand even while sitting on the Sahara desert does this as 
> follows:

I often find grains of Sahara-sand on my car here in Northern-Europe, but 
not even Google Chrome can find them.

>    eXplicitly URL a file (on your computer or whatever), while looking 
> at the file, do a <ctrl>f ; see a browser find box and start typing a 
> word; notice as typing that is highlighted. Select "highlight all" and a 
> second color is used to highlight all other instances.

So the user has to do the selection of the local file, the on page 
Javascript is not allowed to do it.

> * Also works same way Win7 IE11, Firefox, etc.

Do what?
 
>> 
>> Perhaps you can explain what you really want?

> * I did.

No, not in a coherent way.

>    I want a program that will do exactly that without one having to 
> press keys (the Ctrl key, the F key, tose comprising the "keyword").

Yes, I presumed that, and told you it cannot be done in a modern browser,
it is a safety measure.

>    A calling program will pass the "keyword" to this one, and 
> appropriate highlighting will show depending if (running now) the search 
> previous/next arrows are used, or "highlight all" is used.

Sorry, I cannot follow what you are saying here.


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#38606

FromRichard Damon <Richard@Damon-Family.org>
Date2020-07-25 20:20 -0400
Message-ID<r%3TG.33884$cc1.3591@fx29.iad>
In reply to#38603
On 7/25/20 8:42 AM, Evertjan. wrote:
> So the user has to do the selection of the local file, the on page 
> Javascript is not allowed to do it.

It would be a violation of the browser security sandbox to let a script
running on a page access an arbitrary file from the computer without
user direction.

[toc] | [prev] | [next] | [standalone]


#38631

FromRobert Baer <robertbaer@localnet.com>
Date2020-08-03 15:01 -0700
Message-ID<RO%VG.271441$PN2.114944@fx48.iad>
In reply to#38603
Evertjan. wrote:
> Robert Baer <robertbaer@localnet.com> wrote on 24 Jul 2020 in
> comp.lang.javascript:
> 
>>> A browser page, inclusive of on plage javascript, is not allowed to
>>> access local files on the client computer.
> 
>> * Excuse me,
> 
> Why should I?
> 
>> even using WinXP IE8 which is so good it cannot find a
>> grain of sand even while sitting on the Sahara desert does this as
>> follows:
> 
> I often find grains of Sahara-sand on my car here in Northern-Europe, but
> not even Google Chrome can find them.
> 
>>     eXplicitly URL a file (on your computer or whatever), while looking
>> at the file, do a <ctrl>f ; see a browser find box and start typing a
>> word; notice as typing that is highlighted. Select "highlight all" and a
>> second color is used to highlight all other instances.
> 
> So the user has to do the selection of the local file, the on page
> Javascript is not allowed to do it.
> 
>> * Also works same way Win7 IE11, Firefox, etc.
> 
> Do what?
>   
>>>
>>> Perhaps you can explain what you really want?
> 
>> * I did.
> 
> No, not in a coherent way.
> 
>>     I want a program that will do exactly that without one having to
>> press keys (the Ctrl key, the F key, tose comprising the "keyword").
> 
> Yes, I presumed that, and told you it cannot be done in a modern browser,
> it is a safety measure.
> 
>>     A calling program will pass the "keyword" to this one, and
>> appropriate highlighting will show depending if (running now) the search
>> previous/next arrows are used, or "highlight all" is used.
> 
> Sorry, I cannot follow what you are saying here.
> 
> 
   Well i did not exactly like the fact that IE8 cannot find Google (the 
grain of sand), and when metaphorically buried in sand by eXplicitly 
giving it the URL it fails to show any images.

[toc] | [prev] | [next] | [standalone]


#38597

FromJJ <jj4public@vfemail.net>
Date2020-07-24 19:27 +0700
Message-ID<1j5tkprrh925z$.1olio0ank8ocm$.dlg@40tude.net>
In reply to#38592
On Fri, 24 Jul 2020 00:08:05 -0700, Robert Baer wrote:
> 
>    How about user picking out [from a selection] a "keyword' (which will 
> be one word) and having a magic combination of simple HTML, CSS, and js 
> to pass that onto the browser keyboard find function [as if one had done 
> a <ctrl>f and then typed in that "keyword"]?
> 
>    Thanks

One problem: there is no function to bring up the browser's Find feature.
There's no way to bring it up programmatically via JavaScript which is
executed in the context of the opened HTML document. Generating the
necessary keyboard events for simulating keyboard key press (i.e. for the
CTRL+F shortcut) would also be impossible, because the browser will ignore
the untrusted event.

If you're trying to highlight words from a given keyword, scroll the
matching keyword into view, it has to be done manually via JS to mimic the
browser's Find feature.

[toc] | [prev] | [next] | [standalone]


#38599

FromRobert Baer <robertbaer@localnet.com>
Date2020-07-24 12:21 -0700
Message-ID<IwGSG.199816$eN2.192008@fx47.iad>
In reply to#38597
JJ wrote:
> On Fri, 24 Jul 2020 00:08:05 -0700, Robert Baer wrote:
>>
>>     How about user picking out [from a selection] a "keyword' (which will
>> be one word) and having a magic combination of simple HTML, CSS, and js
>> to pass that onto the browser keyboard find function [as if one had done
>> a <ctrl>f and then typed in that "keyword"]?
>>
>>     Thanks
> 
> One problem: there is no function to bring up the browser's Find feature.
* I sure could not find a way, spent hours.

> There's no way to bring it up programmatically via JavaScript which is
> executed in the context of the opened HTML document. Generating the
> necessary keyboard events for simulating keyboard key press (i.e. for the
> CTRL+F shortcut) would also be impossible, because the browser will ignore
> the untrusted event.
* It shay.

> 
> If you're trying to highlight words from a given keyword, scroll the
> matching keyword into view, it has to be done manually via JS to mimic the
> browser's Find feature.
> 
    So...even using CSS as a helper, i am SOL?

    Thanks.

[toc] | [prev] | [next] | [standalone]


#38604

FromJJ <jj4public@vfemail.net>
Date2020-07-25 20:06 +0700
Message-ID<e4cyfrw6i6pb.xgneuwo3ixzf$.dlg@40tude.net>
In reply to#38599
On Fri, 24 Jul 2020 12:21:03 -0700, Robert Baer wrote:
> JJ wrote:
>> 
>> If you're trying to highlight words from a given keyword, scroll the
>> matching keyword into view, it has to be done manually via JS to mimic the
>> browser's Find feature.
>> 
>     So...even using CSS as a helper, i am SOL?

You can, but keep in mind that CSS can only be applied to elements. Not
text. So, if you want to highlight a word which is part of a text in a text
node, that word must be enclosed within an element first, before you can
actually style it.

[toc] | [prev] | [next] | [standalone]


#38605

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2020-07-25 11:29 -0700
Message-ID<548c1bdc-2de3-4911-8412-c0244e5725d9n@googlegroups.com>
In reply to#38604
On Saturday, July 25, 2020 at 8:06:08 AM UTC-5, JJ wrote:
> On Fri, 24 Jul 2020 12:21:03 -0700, Robert Baer wrote: 
> > JJ wrote: 
> >> 
> >> If you're trying to highlight words from a given keyword, scroll the 
> >> matching keyword into view, it has to be done manually via JS to mimic the 
> >> browser's Find feature. 
> >> 
> > So...even using CSS as a helper, i am SOL?
> You can, but keep in mind that CSS can only be applied to elements. Not 
> text. So, if you want to highlight a word which is part of a text in a text 
> node, that word must be enclosed within an element first, before you can 
> actually style it.

Not true in the modern day:

<https://developer.mozilla.org/en-US/docs/Web/CSS/::selection>

[toc] | [prev] | [next] | [standalone]


#38608

FromJJ <jj4public@vfemail.net>
Date2020-07-26 20:42 +0700
Message-ID<tohsre0b8zsk$.1sygvzurc7p5y$.dlg@40tude.net>
In reply to#38605
On Sat, 25 Jul 2020 11:29:08 -0700 (PDT), Michael Haufe (TNO) wrote:
> 
> Not true in the modern day:
> 
> <https://developer.mozilla.org/en-US/docs/Web/CSS/::selection>

That's basically not the text. It's the selection.

[toc] | [prev] | [next] | [standalone]


#38634

FromArno Welzel <usenet@arnowelzel.de>
Date2020-08-04 04:38 +0200
Message-ID<hos01gFabi0U1@mid.individual.net>
In reply to#38605
Michael Haufe (TNO):

> On Saturday, July 25, 2020 at 8:06:08 AM UTC-5, JJ wrote:
>> On Fri, 24 Jul 2020 12:21:03 -0700, Robert Baer wrote: 
>>> JJ wrote: 
>>>>
>>>> If you're trying to highlight words from a given keyword, scroll the 
>>>> matching keyword into view, it has to be done manually via JS to mimic the 
>>>> browser's Find feature. 
>>>>
>>> So...even using CSS as a helper, i am SOL?
>> You can, but keep in mind that CSS can only be applied to elements. Not 
>> text. So, if you want to highlight a word which is part of a text in a text 
>> node, that word must be enclosed within an element first, before you can 
>> actually style it.
> 
> Not true in the modern day:
> 
> <https://developer.mozilla.org/en-US/docs/Web/CSS/::selection>

CSS will only be applied to the text which *is* *selected* and not *to*
select it.


-- 
Arno Welzel
https://arnowelzel.de

[toc] | [prev] | [next] | [standalone]


#38635

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2020-08-03 19:43 -0700
Message-ID<c24abe08-62e1-4c45-9749-1e319247dc02o@googlegroups.com>
In reply to#38634
On Monday, August 3, 2020 at 9:38:45 PM UTC-5, Arno Welzel wrote:
> Michael Haufe (TNO):
> > Not true in the modern day:
> > 
> > <https://developer.mozilla.org/en-US/docs/Web/CSS/::selection>
> 
> CSS will only be applied to the text which *is* *selected* and not *to*
> select it.

Yes, and Thomas Lahn showed how to perform the latter more than a week ago. Use both of our suggestions for the desired effect.

[toc] | [prev] | [next] | [standalone]


#38602

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2020-07-25 00:57 +0200
Message-ID<11567466.O9o76ZdvQC@PointedEars.de>
In reply to#38597
JJ wrote:

> On Fri, 24 Jul 2020 00:08:05 -0700, Robert Baer wrote:
>>    How about user picking out [from a selection] a "keyword' (which will
>> be one word) and having a magic combination of simple HTML, CSS, and js
>> to pass that onto the browser keyboard find function [as if one had done
>> a <ctrl>f and then typed in that "keyword"]?
> 
> One problem: there is no function to bring up the browser's Find feature.
> There's no way to bring it up programmatically via JavaScript which is
> executed in the context of the opened HTML document. 

That is simply not true.  window.find() – a method, not a function – exists 
since time immemorial, is well-documented, and still works in recent Web 
browsers.  The result of calling it and finding the specified text string is 
selecting the next occurrence of the text in the document and moving the 
focus to it.  It returns “true” if the text was found, “false” otherwise.

However, using it is not without problems:

<https://developer.mozilla.org/en-US/docs/Web/API/Window/find>

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web