Skip to content

Commit 05875e0

Browse files
committed
PC以外で起動しようとしたらalertを出す
1 parent 5d40473 commit 05875e0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

routes/+page.svelte

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
<script lang="ts">
2-
import { onDestroy } from "svelte";
2+
import { onDestroy, onMount } from "svelte";
33
4+
onMount(() => {
5+
const userAgent = navigator.userAgent.toLowerCase();
6+
if (
7+
userAgent.includes("android") ||
8+
userAgent.match(/iphone|ipad|ipod/) ||
9+
(userAgent.includes("macintosh") && navigator.maxTouchPoints >= 1) /* recent iPad */
10+
) {
11+
window.alert("このゲームはPC用です。キーボードが接続されていない端末ではプレイできません。");
12+
}
13+
});
414
onDestroy(() => {
515
// document.body.style.backgroundColor = "black";
616
});

0 commit comments

Comments
 (0)