Created
February 3, 2014 16:41
-
-
Save taf2/8787353 to your computer and use it in GitHub Desktop.
This file contains 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
// in a script file - we can attach a listener to a form ... this code handles the case that the form is for creating and editing a record. the code below detects whether the UA supports pushState and rather than redirecting to get the new window state, it can do this client side and use pushState to set the URL correctly.. | |
if (updateOnNew && typeof(window.history.pushState) == 'function') { | |
window.history.pushState("", "Edit Schedule", schedule.update_url + "/edit"); | |
// update any local page state... | |
} else if (updateOnNew) { | |
window.location = schedule.update_url + "/edit"; // older browser must redirect on new update | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment