window.localStorage doesn't exist in (for example) IE 7, and it may or may not exist in IE8 depending on the domain. So you can't rely on the interface being the same.
Plenty of libraries written in statically typed languages add features which may not be supported on legacy platforms. There are ways to deal with this. In version X you provide a way to let the client know that function Y is not supported on the current platform.
It's not like the web is some completely different animal, it's just an example of poor/little standardization and a design which has not evolved well over time.