go - Safari reloading web page 3 times during redirect -
for life of me thought going mad because far see was/is ok code in regards. out of exasperation decided try application in browser , found in chrome , ff app works fine, in safari reason refreshes page 3 times. i've tried resetting safari , turning off extensions in case issue same thing happens.
i'm not sure if quirk setup, or potentially code i've pasted here below have other eyes @ it. if more code/context required, please let me know. in essence takes user index page, movie page , repeats 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 selected") http.redirect(w, r, "/", http.statusfound) return } err := pagedata.player.startfilm(film) if err != nil { log.printf("following error occurred: %v\n", 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\n", 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\n", err) } } } else { http.redirect(w, r, "/", http.statusfound) return } rendertemplate(w, "movie.html") }
note: i'm still inexperienced coder (especially go), additional input on improving code in other way appreciated.
Comments
Post a Comment