8000 Added information about how to get the WebBrowser object by OlliTietavainenVaadin · Pull Request #4269 · vaadin/docs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added information about how to get the WebBrowser object #4269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 22, 2025
Merged
18 changes: 17 additions & 1 deletion articles/flow/advanced/browser-access.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,23 @@ UI.getCurrent().getPage().fetchCurrentURL(currentUrl -> {
});
----

// TODO add documentation on VaadinSession.getCurrent().getBrowser()
== Accessing Browser Information

During the initial HTTP request, Vaadin reads the user-agent information supplied by the browser and stores them in a [classname]`WebBrowser` instance, which is accessible from the current [classname]`VaadinSession`.

Here’s an example how to get the `WebBrowser` instance and access some of the user-agent information:

[source,java]
----
WebBrowser browser = VaadinSession.getCurrent().getBrowser();
// Print the raw user-agent string
System.out.println(browser.getBrowserApplication());
// Print some parsed browser details
System.out.println("Is Windows: " + browser.isWindows());
System.out.println("Is Chrome: " + browser.isChrome());
System.out.println("Major version: " + browser.getBrowserMajorVersion());
----


== Getting the Extended Client-Side Details

Expand Down
Loading
0