fix (IE): block IE to avoid a shitty experience of their platform

This commit is contained in:
Mickael Kerjean 2019-05-27 22:10:40 +10:00
parent 787660f680
commit fc0189a2c0

View file

@ -43,15 +43,19 @@ func IndexHandler(_path string) func(App, http.ResponseWriter, *http.Request) {
res.WriteHeader(http.StatusNotFound) res.WriteHeader(http.StatusNotFound)
res.Write([]byte(Page("<h1>404 - Not Found</h1>"))) res.Write([]byte(Page("<h1>404 - Not Found</h1>")))
return return
} else if ua := req.Header.Get("User-Agent"); strings.Contains(ua, "MSIE ") { }
res.WriteHeader(http.StatusBadRequest) ua := req.Header.Get("User-Agent");
if strings.Contains(ua, "MSIE ") || strings.Contains(ua, "Edge/"){
// Microsoft is behaving on many occasion differently than Firefox / Chrome.
// I have neither the time / motivation for it to work properly
res.WriteHeader(http.StatusBadRequest)
res.Write([]byte( res.Write([]byte(
Page(` Page(`
<h1>Internet explorer is not yet supported</h1> <h1>Internet explorer is not supported</h1>
<p> <p>
To provide the best possible experience for everyone else, we don't support IE at this time. We don't support IE / Edge at this time
<br> <br>
Use either Chromium, Firefox or Chrome Please use either Chromium, Firefox or Chrome
</p> </p>
`))) `)))
return return