google / google/fonts

Google Fonts returning "local('sans-serif')" before "Roboto*" URL's if user-agent includes Android > 4.0

Open
#2,034 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
20.5k
Forks
2.9k
Avg merge
1d 21h
Merged PRs (30d)
95

Description

### Steps to reproduce

Set user-agent to: `Mozilla/5.0 (Linux; Android 5.0; SM-G892A Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/67.0.3396.87 Mobile Safari/537.36`

Load URL: `https://fonts.googleapis.com/css?family=Roboto%3A300%2C400%2C700`

#### Actual result
"local('sans-serif')" is preceding the URL of the Font-File using the sans-serif font if installed on system.
```
...
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), local('sans-serif'), url(https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxKKTU1Kg.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
...
```
#### Expected result

local('sans-serif') should be omitted in result.

---

Setting the Android version to 4.0 (or lower) or exclude Android completely the "local('sans-serif')" is omitted.

```
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(https://fonts.gstatic.com/s/roboto/v19/KFOmCnqEu92Fr1Mu4mxK.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
```

The problem is reproducable for me with all browsers (Chrome, Chromium, Firefox, Opera ...) on all platforms (Windows ..., Linux).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.