Hello!
I would like to share my solution, since I just used this client-side trick. Thanks to @sjtrny !
app.layout = html.Div([
dcc.Location(id='url'),
html.Div(id='viewport-container')
])
app.clientside_callback(
"""
function(href) {
var w = window.innerWidth;
var h = window.innerHeight;
return {'height': h, 'width': w};
}
""",
Output('viewport-container', 'children'),
Input('url', 'href')
)