πŸ‘€
Find In Page
Integrate native web "find in page" feature

todesktop.contents.findInPage.start(text, options)

To start the find in page feature, all you need is specify a text (string).
1
todesktop.contents.findInPage.start(text)
Copied!
You can also configure the experience using these options:
  • forward Boolean (optional) - Whether to search forward or backward, defaults to true
  • findNext Boolean (optional) - Whether the operation is first request or a follow up, defaults to false
  • matchCase Boolean (optional) - Whether search should be case-sensitive, defaults to false
For example, to find text backward:
1
todesktop.contents.findInPage.start(text, { forward: false })
Copied!

todesktop.contents.findInPage.stop()

Stop find in page

todesktop.on("found-in-page", eventHandler)

You can also listen to the event found-in-page to update your UI accordingly when the find in page feature is being used.
1
window.todesktop.on("found-in-page", (event, result) => {
2
// ...
3
})
Copied!
  • event Event
  • result Object
    • requestId Integer
    • activeMatchOrdinal Integer - Position of the active match.
    • matches Integer - Number of Matches.
    • selectionArea Rectangle - Coordinates of first match region.
    • finalUpdate Boolean