sammy icon indicating copy to clipboard operation
sammy copied to clipboard

Relative route links in IE10 creates incorrect url

Open toha73 opened this issue 10 years ago • 0 comments

When you have anchor elements where the href is relative, ie. '#/form1', and follow the link to the route the address in the address is incorrect in IE10. This is because pathname for anchor element is an empty string in IE10 if the link is relative with hash.

Try this is IE10 and other browsers to see the difference:

var anchor = document.createElement('a');
anchor.href = '#/design';
alert("'" + anchor.pathname + "'");

I added a small fix in Sammy.DefaultLocationProxy.fullPath that seems to work:

return [location_obj.pathname || window.location.pathname, location_obj.search, hash].join('');

toha73 avatar Jun 19 '14 14:06 toha73