Skip to content

Update browser-access.adoc #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

Open
wants to merge 7 commits into
base: latest
Choose a base branch
from
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions articles/flow/advanced/browser-access.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@ 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`.

.Getting the browser object
[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