At least execution transfers from the calling HTML to the desired destination HTML.
BUT. the keyword does NOT get underlined or highlighted in any way. It would be particularly nice if all the keywords got highlighted and the first keyword was presented on the screen (think loong document and keyword was in middle).
If course not. Why should adding "?find=able" do that?
Technically calling "downhole-measurements.html?find=able" will just open the document referred by "downhole-measurements.html" and pass the querystring "find=able" to the server.
If the document was opened locally as file and not via HTTP then adding "?find=able" does nothing at all.
Then you need to build some server side script which reads the document and *adds* elements to highlight the places where the searched text was found. For example if you use PHP on the server the URL could be:
Then the script "find.php" will get the paramters "document" and "text", where "document" tells it which file to read and "text" which text to search for.
You mean "without adding Javascript" refers to the document. Adding matching tags all over the document is not sane; there are thousands of words needed to be found/highlighted.
Better to get the browser to do its thing; even IE8 does a nice brwser FIND().
It will open the file, read the content, does a strpos() on the search term and add ... around the found word. You may also need to add the "found" CSS rule like this:
.found { background-color: #ff0; }
If you want to keep the URL "downhole-measurements.html?find=able" you can also do this with a script in the document itself which takes the URL (window.location.href), extracts the "find" parameter and calls either window.find() or walks the DOM tree to add a ... around the search hits - but in any case you need *code* to do the finding. There is no solution which just works by adding something to the URL.
What is happening then depends on the user agent. It is NOT a general command to highlight something. HTML is NOT a programming language.
The FIND command of CMD.exe has *nothing to do* with HTML/JavaScript. JavaScript is *case-sensitive*. And ?window? is NOT ?windows?.
HTML is _NOT_ a programming language. HTML does NOT ?execute? and does NOT ?call?.
Of course not. HTML ? HyperText *Markup* Language ? is _NOT_ a programming language. To highlight something *in general*, you need a *programming* language.
/*** highlight.js ? Highlights occurrences of text in HTML documents * @author (C) 2020 Thomas 'PointedEars' Lahn * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. ** The program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License at * for more details. */
var highlight = { getNeedle: function () { /* Get value of value of ?find? parameter */ var value = (window.location.search.match(/[?&]find=([^&#]+)/) || [,]) [1]; if (value) value = decodeURIComponent(value); return value; },
focus: function (needle) { if (needle) { /* Focus first occurence */ if (typeof window.find != 'undefined' && !window.find(needle)) { if (typeof console != 'undefined' && typeof console.log != 'undefined') { console.log('Text not found: "' + needle + '"'); } } } },
highlight: function (needle) { if (needle) { /* Highlight all occurrences */ document.body.innerHTML = document.body.innerHTML.replace( new RegExp( /* slurp textareas and tags */ '((?:[^
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.