vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
618 stars 167 forks source link

Unsupported browser version in Chrome iPhone responsive mode #14362

Open HawkSK opened 2 years ago

HawkSK commented 2 years ago

Description of the bug

When using the latest Chrome in responsive layout with iPhone emulation (any of the choices iPhone SE, iPhone XR or iPhone 12 Pro) I get the user agent

Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1

which is resolved by isTooOldToFunctionProperly to true. This result in the error page provided by UnsupportedBrowserHandler with header

I'm sorry, but your browser is not supported

In contrast, while using Edge, the user agent is very similar, but is supported.

Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/104.0.5112.81

Expected behavior

Vaadin app should be usable in Chrome responsive layout with iPhone emulation.

Minimal reproducible example

public class VaadinBrowserDetailsTest {
    private static final String USER_AGENT_RESPONSIVE_EDGE_IPHONE = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/104.0.5112.81";
    private static final String USER_AGENT_RESPONSIVE_CHROME_IPHONE = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1";
    @Test
    public void testEdge() {
        var details = new BrowserDetails(USER_AGENT_RESPONSIVE_EDGE_IPHONE);
        Assertions.assertFalse(details.isTooOldToFunctionProperly()); // passes
    }
    @Test
    public void testChrome() {
        var details = new BrowserDetails(USER_AGENT_RESPONSIVE_CHROME_IPHONE);
        Assertions.assertFalse(details.isTooOldToFunctionProperly()); // fails
    }
}

Versions

mcollovati commented 2 years ago

For Edge we check browser version (Edg/104.0.5112.81) to be at least 79, whereas for IPhone we check operating system version (OS 13_2_3 like Mac OS X) to be at least 14.7 when browser version (Version/13.0.3) is less than 14 (see #11654 and #13271) .

mcollovati commented 2 years ago

Related to #14366