history.js icon indicating copy to clipboard operation
history.js copied to clipboard

History.getLocationHref on Pages With Form Named "Location"

Open jproffitt3ge opened this issue 10 years ago • 1 comments

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).

jproffitt3ge avatar Jan 13 '15 16:01 jproffitt3ge

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.

jproffitt3ge avatar Jan 15 '15 17:01 jproffitt3ge