You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the state is not UNSENT or OPENED, throw an "InvalidStateError" exception and terminate these steps.
If the send() flag is set, throw an "InvalidStateError" exception and terminate these steps.
意味着规范里写着只要在send之前调用,open和withCredentials的顺序应该不会导致InvalidStateError才对。所以zepto这样写应该还是符合规范的,作者之所以不把open提前,原因可见https://github.com/madrobby/zepto/issues/921。
问题描述:
在用小米2,安卓版本4.01.07,qq5.9.1,zepto1.1.6测试页面的时候发现页面报JS错误。
原因:
具体跟进发现zepto1.1.6里有这么一段
第一行语句会给xhr.withCredentials赋值。
在特定机型特定系统特定浏览器下,
如果2在1之后调用会导致异常。
看看w3c里的描述:
http://www.w3.org/TR/2012/WD-XMLHttpRequest-20120117/#the-withcredentials-attribute
里面有这么一段:
意味着规范里写着只要在send之前调用,open和withCredentials的顺序应该不会导致InvalidStateError才对。所以zepto这样写应该还是符合规范的,作者之所以不把open提前,原因可见https://github.com/madrobby/zepto/issues/921。
解决方案:
快速的解决方案可以考虑: