diff --git a/internal/web/mobile.go b/internal/web/js.go similarity index 89% rename from internal/web/mobile.go rename to internal/web/js.go index c9a2e4f5d..0e323f0fb 100644 --- a/internal/web/mobile.go +++ b/internal/web/js.go @@ -44,3 +44,8 @@ func isAndroidChrome() bool { func IsMobileBrowser() bool { return isIOS() || isAndroidChrome() } + +func IsEdgeBrowser() bool { + ua := js.Global.Get("navigator").Get("userAgent").String() + return strings.Contains(ua, "Edge") +} diff --git a/internal/web/notjs.go b/internal/web/notjs.go new file mode 100644 index 000000000..3250b9ce0 --- /dev/null +++ b/internal/web/notjs.go @@ -0,0 +1,25 @@ +// Copyright 2017 The Ebiten Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !js + +package web + +func IsMobileBrowser() bool { + return false +} + +func IsEdgeBrowser() bool { + return false +}