Skip to content

Commit

Permalink
Adds warning banner to macOS safari and all iOS browsers (#25)
Browse files Browse the repository at this point in the history
* v1

* Update message

* Remove chromeios from checklist
  • Loading branch information
russellchapin authored Sep 4, 2024
1 parent 1861e39 commit 53aaf2c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,21 @@
.xterm-viewport {
border-radius: 10px;
}
.top-banner {
padding: 5px;
font-size: .9rem;
background-color: #eee;
align-items: center;
justify-content: center;
flex-direction: row;
width: 100%;
}
.hidden {
display: none;
}
.visible {
display: flex;
}
@media only screen and (max-width: 1200px) {
.hero-container {
flex-direction: column;
Expand Down Expand Up @@ -180,6 +195,7 @@
/>
</head>
<body>
<div id="topBanner" class="top-banner hidden">Thistle Terminal Emulator currently does not work on Safari for macOS or any iOS browser.</div>
<div class="header">
<div class="container">
<div class="header-contents">
Expand Down Expand Up @@ -287,5 +303,29 @@ <h3>Get OTA update with Thistle Update Client (TUC)</h3>
3
);
</script>
<script>
function isSafariOrOnIPhone() {
const userAgent = navigator.userAgent.toLowerCase();
const vendor = navigator.vendor.toLowerCase();

const isSafari = (
vendor.includes("apple") &&
!userAgent.includes("chrome") &&
!userAgent.includes("chromium") &&
!userAgent.includes("firefox") &&
!userAgent.includes("opera") &&
!userAgent.includes("edg") &&
!userAgent.includes("brave")
);

// Check if the user is on an iPhone
const isIPhone = userAgent.includes("iphone");

return isSafari || isIPhone;
}
const showBanner = isSafariOrOnIPhone();
const topBanner = document.getElementById("topBanner");
if(showBanner) topBanner.classList.add("visible");
</script>
</body>
</html>

0 comments on commit 53aaf2c

Please sign in to comment.