Infinite Refresh Loop in Firefox 3.0

Posted by Martin Gordon on Stack Overflow See other posts from Stack Overflow or by Martin Gordon
Published on 2010-05-26T05:11:48Z Indexed on 2010/05/26 15:01 UTC
Read the original article Hit count: 227

I'm having a strange issue with my Javascript in Firefox 3.0.x. In Firefox 3.0.12, the page constantly reloads as soon as the list body is loaded. Neither Firefox 3.5, Safari 4 nor Chrome 5 (all on Mac) experience this issue.

EDIT: I've created an isolated example rather than pulling this from my existing code.

test.js

function welcomeIndexOnLoad() {
  $("#options a").live('click', function () {
    optionClicked($(this), "get_list_body.html");
    return false;
  });

  $(document).ready(function() {
    optionClicked(null, "get_list_body.html");
  });
}

function optionClicked(sender, URL) {
  queryString = "";
  if (sender != null) {
    queryString = $(sender).attr("rel");
  }
  $("#list_body").load(URL + "?" + queryString, function(resp, status, AJAXReq) {
    console.log(resp);
    console.log("" + status);
    location.hash = queryString;
  });
}?

test.html

<html>
<head>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
  <script type="text/javascript" src="test.js"></script>
  <script>
    welcomeIndexOnLoad();
  </script>
</head>

<body>
<div id="container">
  Outside of list body.
  <div id="list_body">
  </div>
</div>
</body>
</html>

get_list_body.html

<h3>
  <div id="options">
    <a href="#" rel="change_list">Change List</a>
  </div>
<ul>
  <li>li</li>
</ul>

jQuery line 5252 (an xhr.send() call) shows up in the console as soon as the page reloads:

xhr.send( type === "POST" || type === "PUT" || type === "DELETE" ? s.data : null );

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery