Created
May 18, 2016 15:32
-
-
Save venoms/f415084af729367c810a7900b117fcde to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
func cors(h http.Handler) http.Handler { | |
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | |
w.Header().Set("Access-Control-Allow-Methods", "DELETE") | |
h(w, r) | |
}) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.onpopstate = function(ev) { | |
with(new XMLHttpRequest) | |
addEventListener("load", function(){ document.body.parentElement.innerHTML = this.responseText }), | |
addEventListener("error", function(){ document.body.parentElement.innerHTML = "it broke" }), | |
open("DELETE", window.location), | |
send(); | |
} | |
Array.prototype.forEach.call(document.getElementsByTagName("a"),function(el){ | |
el.addEventListener("click", function(){ history.pushState(this.href,"", this.href) ; return false }) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment