👀
Find In Page
Integrate native web "find in page" feature
To start the find in page feature, all you need is specify a text (string).
todesktop.contents.findInPage.start(text)
You can also configure the experience using these
options
:forward
Boolean (optional) - Whether to search forward or backward, defaults totrue
findNext
Boolean (optional) - Whether the operation is first request or a follow up, defaults tofalse
matchCase
Boolean (optional) - Whether search should be case-sensitive, defaults tofalse
For example, to find text backward:
todesktop.contents.findInPage.start(text, { forward: false })
Stop find in page
You can also listen to the event
found-in-page
to update your UI accordingly when the find in page feature is being used.window.todesktop.on("found-in-page", (event, result) => {
// ...
})
event
Eventresult
ObjectrequestId
IntegeractiveMatchOrdinal
Integer - Position of the active match.matches
Integer - Number of Matches.selectionArea
Rectangle - Coordinates of first match region.finalUpdate
Boolean