Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to capture plain text site into a variable using JavaScript or jQuery?
    primarykey
    data
    text
    <p>I need to save all the content of a website inside a variable in order to search for a specific string.</p> <p>Here is an example of how the content looks like, it's literally a plain text log.</p> <pre><code>====================================================================== BEGIN_TEXT APPLEYARD IAN 23761347 BA 2 Airport Data: Code = JFK Name = JFK/John F Kennedy International City = New York State = NY Airport Data: Code = LCY Name = Lcy/London City Airport ' City = London State = England sysTime:XXXXXXXXX0000 year:2012 month:7 day:16 hour:7 min:10 pm,END_TEXT ====================================================================== ----(1341920977.93286) 2012/07/10 12:03:22.582 MAP UNAVAIL-AIRPORT CHECK IN ONLY * &gt; ====================================================================== ----(1341920977.93286) 2012/07/10 12:03:23.202 I ====================================================================== ----(1341920977.93286) 2012/07/10 12:03:23.337 IGND &gt; ====================================================================== ----(1341920977.93286) 2012/07/10 12:03:23.337 9V/BA2R16AUGJFKLCY ====================================================================== </code></pre> <p>This was my original idea:</p> <pre><code>var content = document.body.textContent; //But there is no body! var pos = content.search("UNAVAIL-AIRPORT"); // Just an example to search for </code></pre> <p>So my questions are:</p> <ol> <li>How do I capture that content?</li> <li>Once I get the position of the string, how can I scroll there and highlight the match? I basically want to recreate the CTRL + F function.</li> </ol> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload