The JavaFX WebView allows you to set a user agent string, using the user agent property on the WebEngine. You can use this to set the user agent to anything that you wish. Then when the WebView client requests a web page, it will supply this value in the user agent header. Your server code can query the user agent header and then take whatever action it deems necessary based upon the result.
From this answer, the default output for the user agent string was:
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.44 (KHTML, like Gecko) JavaFX/8.0 Safari/537.44
As noted in the WebEngine documentation, this value can change between JavaFX versions and operating systems. Most likely, the default will always include the text JavaFX
, so you could just check on the server if the user agent string contains the text JavaFX
. Otherwise, if you want to be super-sure, then you can code your JavaFX client to explicitly set the user agent string to a value which you check on your server.
To see how to check a user agent in a JSP, refer to:
Which would indicate that you would write something like this:
<c:if test="${fn:contains(header['User-Agent'],'JavaFX')}"></c:if>