2

I have built the GeckoView into my app. It works quite well so far. Now I want to send an event to the script in GeckoView when the backbutton ("onBackPressed" ) is pressed.

Is it possible to start a Javascript function of an open page within a GeckoView?

Or can I alternatively send an event to the page in GeckoView?

the function GeckoView.importScript() don't exist any more in it...

jesup
  • 6,765
  • 27
  • 32
arivdev
  • 21
  • 1

1 Answers1

0

There are two options:

  1. Load a "javascript:..." URI. I'm not sure if that gives you access to the current document though.
  2. Load a WebExtension into GeckoView and then use the Messaging API to communicate from your Java/Kotlin code to the content script of your extension.
pocmo
  • 660
  • 6
  • 24