Hi, I’m trying to make a search bar extension which is supposed to take the entered information and search it on the website. This is the code so far: https://prnt.sc/uae512, https://prnt.sc/uae58z https://prnt.sc/uae5jhThe website is http://getcode.herokuapp.com. It’s supposed to search the website based on title entered in the search bar field for the snippet. Any help would be appreciated.
Thank you.
Searching is hard. Even though it sounds easy.
One solution is to use one of the existing libraries, like MarkJS:
If you are targeting Firefox only, you can use Find API:
Still, not an easy task at all!
Some problems to think about:
- many pages renders content “on demand”, like Facebook where data appears only when you scroll down. So you need Mutation Observer to react to those changes. Mutation Observer is not an easy API
.
- single word on the page can consists of multiple nodes, like “thi
s
” (4 nodes!). But both Find API and MarkJS should find it.
Hmm, it doesn’t seem that your popup submits a form or passes arguments in the URL to the destination site.