How does this create an error?
I have a jquery/ajax website at tarh33ls.com For some reason, in firefox, i get the following error:
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLo开发者_运维百科cation.href]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://tarh33ls.com/ :: :: line 26" data: no]
Line 0
but line 26 is:
if (location.href.indexOf("#")==-1) {location.href="http://tarh33ls.com/#";}
How would that generate an error?
I'm not sure why the error happens, but it seems this fixes it:
Move the if (location.href.indexOf("#") == -1
code inside the $(document).ready
block (at the top of it), like this:
$(document).ready(function() {
if (location.href.indexOf("#") == -1) {
location.href="http://tarh33ls.com/#";
}
$.ajaxSetup({
...etc
精彩评论