history.js
history.js copied to clipboard
History.getLocationHref on Pages With Form Named "Location"
The plugin errors on initialization ("Cannot read property 'indexOf' of undefined") when a form with the name "location" is present on the page and the script is loaded at the end of the body. Apparently that form takes the place of document.location.
Recreated this in a codepen: http://codepen.io/anon/pen/xbqZQJ (Could not use jsfiddle, due to some problem saving it).
Right now I've worked around this by changing the form name property (not attribute) on load using jQuery (jQuery('form').filter('[name="location"]').prop('name', 'locationForm');). This doesn't change the data produced by jQuery's serialization methods, but it does change the property on the document object.