Safari在重定向期间重新加载网页3次

For the life of me I thought I was going mad because as far as I could see everything was/is ok with the code in that regards. Out of exasperation I decided to try my application in another browser and found that in Chrome and FF the app works fine, but in Safari for some reason it refreshes the page 3 times. I've tried resetting Safari and turning off extensions in case that was the issue but the same thing happens.

I'm not sure if this is just a quirk with my setup, or potentially my code so I've pasted it here below to have some other eyes look at it. If more code/context is required, please let me know. In essence it takes the user to the index page, the movie page and repeats this process 3 times.

func movieHandler(w http.ResponseWriter, r *http.Request) {
    command := r.URL.Query().Get("command")
    film := r.URL.Query().Get("movie")

    if pageData.Player.Playing == false {
        if film == "" {
            log.Println("No film was selected")
            http.Redirect(w, r, "/", http.StatusFound)
            return
        }
        err := pageData.Player.StartFilm(film)
        if err != nil {
            log.Printf("Following error occurred: %v
", err)
            http.Redirect(w, r, "/", http.StatusFound)
            return
        }
        pageData.CurrentFilm = film
    } else if pageData.Player.Playing && (film == "" || pageData.Player.FilmName == film) {
        if command == "kill" {
            err := pageData.Player.EndFilm()
            if err != nil {
                log.Printf("Following error occurred: %v
", err)
            }
            http.Redirect(w, r, "/", http.StatusFound)
            return
        } else if command != "" {
            err := pageData.Player.SendCommandToFilm(command)
            if err != nil {
                log.Printf("Following error occurred: %v
", err)
            }
        }
    } else {
        http.Redirect(w, r, "/", http.StatusFound)
        return
    }
    renderTemplate(w, "movie.html")
}

Note: I'm still an inexperienced coder (especially with go), so additional input on improving this code in any other way is appreciated.

dongxing7318
dongxing7318 看了网络部分,列出的唯一内容是各种css和javascript文件。没有提及网站图标。
大约 4 年之前 回复
dragon321723
dragon321723 这是浏览器特定的功能,即使您没有设置,它也会寻找它。是的,请检查开发人员工具中的网络面板。
大约 4 年之前 回复
drq231358
drq231358 我将如何查看是否在寻找呢?(我猜它在Safari的开发人员工具中?),但我在任何地方都没有提到favicon。.在任何情况下我都没有设置。
大约 4 年之前 回复
dongpeng7744
dongpeng7744 您可以检查浏览器是否多次请求favicon.ico?
大约 4 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问