We add a todesktop class to the html element on each page of your app. You can use this to identify when your app is being run as a desktop app.
If you want to hide an element on your desktop app you could do something like this:
app.css
index.html
1
.announcement{
2
background-color: hotpink;
3
/* other styles... */
4
}
5
β
6
html.todesktop .announcement{
7
display: none;
8
}
Copied!
1
<body>
2
<divclass="announcement">
3
You should download our desktop app!
4
</div>
5
<!-- rest of your app -->
6
</body>
Copied!
You can also do the opposite and only show an element in your desktop app.
A common use-case is to show browser controls (back, forward, refresh) in your desktop app's user interface. Here's an example of how you could achieve this: