How get windows FIND() to work?

Clifford Heath wrote on 06 Aug 2020 in comp.lang.javascript:

Reply to
Evertjan.
Loading thread data ...

I do NOT know the solution; requiring the user to enter f is not a sane requirement,

Thanks

Reply to
Robert Baer

Other than "forcing" a browser to doa nominally manual search, that seems to be true.

However, the grand expert Thomas 'PointedEars' Lahn may have given us highlight.js as an answer

Thanks

Reply to
Robert Baer

...and....i also mentioned to add all that in every document for thousands of keywords into a goodly batch of documents is not exactly sane.

Thanks

Reply to
Robert Baer

Talk to "moz".

Reply to
Robert Baer

May i quote DIRECTLY from that site:

*QUOTE* Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

Note: Support for Window.find() might change in future versions of Gecko. See bug 672395.

*END QUOTE*
Reply to
Robert Baer

Reply to
Robert Baer

Robert,

To help someone even more "stupid" ?

Being able to send a friend/granny/client an URL which causes the webpage scroll to and hilite the phrase/line you want them to read an talk about could be quite handy. Not everyone knows (or wants to know!) how to use their webbrowser beyond clicking a link and scroll thru the result.

Heck, I could even emagine it being handy for myself as a way to "bookmark" stuff on certain webpages, even on pages I've stored locally.

Also, what makes you think that whomever wants to use such an URL needs to construct it himself ? I could imagine a local page containing some JS could do it. Also, plugins, other kinds of scripting (VBScript) and programs. Just drop the URL and sought-for text into two input fields, press the button and copy the result.

Regards, Rudy Wieser

Reply to
R.Wieser

Reply to
Clifford Heath

Robert Baer:

Exactly!

I did never say, that this is standard. I mentioned it so it is clear that this is NOT standard!

--
Arno Welzel 
https://arnowelzel.de
Reply to
Arno Welzel

Robert Baer:

Huh?

And to search for something there:

This is just a rough "quick & dirty" example and uses window.find() and URLSearchParams(). This is NOT standard and may NOT work with every browser. It works for me with Firefox 79.0 and should also work with most Chrome based browsers.

However - I would *not* recommend this for production. And for highlighting *every* found word, adding next/prev etc. you need to create your own script.

--
Arno Welzel 
https://arnowelzel.de
Reply to
Arno Welzel

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.