How can I get the user agent string in a Dash app?

@the.oldest.house

I understand what you are trying to do, and css frameworks such as Bootstrap are designed to solve this exact problem. You do not need to have two layouts or try to get the User Agent to accomplish this goal.

I recommend copying and pasting the example from the link I also sent earlier and running it on your own computer without making any changes. You should see the following. Notice that the layout dynamically changes with the screen size

dynamic_layout

Next, you can use the layout in this example as a model and apply it to your app. You can also see more information in the dash bootstrap documentation on the layout page.

If you still have issues, please make a minimal example (like the one above) demonstrating how it’s not working - then someone here will be able to help you further.

3 Likes