I need to save all the content of a website inside a variable in order to search for a specific string.
Here is an example of how the content looks like, it's literally a plain text log.
======================================================================
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 *
>
======================================================================
----(1341920977.93286)
2012/07/10 12:03:23.202
I
======================================================================
----(1341920977.93286)
2012/07/10 12:03:23.337
IGND
>
======================================================================
----(1341920977.93286)
2012/07/10 12:03:23.337
9V/BA2R16AUGJFKLCY
======================================================================
This was my original idea:
var content = document.body.textContent; //But there is no body!
var pos = content.search("UNAVAIL-AIRPORT"); // Just an example to search for
So my questions are:
- How do I capture that content?
- 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.
Thanks in advance!