3

Im trying to Code a Programm with a WebView with includes reCaptcha by Google. When i load the Web Page it says that my Browser doesnt Support reCaptcha. Is there anyway to fix this with a method or something?

Thanks!

Cryn0x
  • 33
  • 3
  • I wonder whether it's the same problem as solved here https://stackoverflow.com/questions/44905264/cannot-sign-in-to-google-in-javafx-webview/44906031#44906031 (same origin policy blocking the javascript) – Michael Jan 01 '18 at 01:15
  • @Michael This solution doesnt work. I dont know whats causing the problem. But thanks for the help. (Just in case, im working with an FXML Document Controller) – Cryn0x Jan 01 '18 at 01:38

2 Answers2

5

Override user by overriding the User agent string using WebEngine.setUserAgent("use required / intended UA string");

Priyanka
  • 115
  • 2
  • Tried the same, but not working. Getting the error - RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment. – Vishal Thareja Jun 21 '19 at 05:21
  • Change useragent to the latest useragents of chrome does not change behaviour. Simplest pages are returning this error using webview - even without captcha usage. JavaFx 20 used. – tonimaroni Jun 23 '23 at 08:21
0

There are a lot of issues with this:

  1. In order to use a ReCaptcha, you need to have an HTTP/HTTPS environment, so you cannot serve the local file statically from WebView. This means that you'll have to either host your page online or on localhost and then open that within WebView.
  2. As Priyanka mentioned, you can also override the user agent string as said, but the WebView browser still doesn't have all the JS libraries that you need (as of 2020, the "click all squares that have traffic lights" isn't functional).

I would probably recommend opening the auth page in the user's local browser and then using some kind of callback function.

Varun Mathur
  • 898
  • 8
  • 11