Loading ...
Sorry, an error occurred while loading the content.

Re: Get Utility in FF after disconnection from the network and reconnection.

Expand Messages
  • dolittle919
    ... http://search.yahooapis.com/SiteExplorerService/V1/inlinkData? + ... appid=3wEDxLHV34HvAU2lMnI51S4Qra5m.baugqoSv4gcRllqqVZm3UrMDZWToMivf5BJ3Mom + ...
    Message 1 of 7 , Dec 21, 2007
    • 0 Attachment
      --- In ydn-javascript@yahoogroups.com, Adam Moore <adamoore@...> wrote:
      >
      > On Thu, Dec 20, 2007 at 11:06:30PM -0000, dolittle919 wrote:
      > > It`s easy to reproduce with the GET example on the yui website with
      > > latest stable FireFox version and with FireFox 3 beta 2 on XP (not
      > > with LAN):
      > > http://developer.yahoo.com/yui/examples/get/get-script-basic.html
      > >
      > > - click the button to retrieve JSON data.
      > > - disconnect from the network.
      > > - sometimes you need to try and retrive JSON when you are not
      > > connected to reproduce the bug.
      > > - reconnect.
      > > - try to retrieve JSON again and see that it doesn't work on FireFox.
      > >
      > > FireFox doesn't cause network issues. I only want my app to be stable
      > > even in these conditions so I`m simulating disconnection and
      > > reconnection. Gmail for example is is able to reconnect but it`s
      > > possible that they are loading a new iframe which I can't in my app.
      >
      > In this example, a callback is executed by the inserted script. Since
      > the Get utility also executes a callback after the script is finished
      > loading, it may be possible to detect and account for this error
      > condition in FireFox (assuming that FireFox still fires the onload event
      > for the script node even though the script it contains isn't executed,
      > which may not be the case). The following code (completely
      > untested) shows how you might accomplish this:
      >
      > YAHOO.example.Retry = function() {
      >
      > var processing, done, Get=YAHOO.util.Get;
      >
      > return {
      >
      > // executed by the inserted script
      > callback: function(o) {
      > done = true;
      > // process data;
      > processing = null;
      > },
      >
      > fetch: function(what) {
      >
      > if (processing) {
      > // no concurrent requests
      > return false;
      > }
      >
      > processing = what;
      > done = false;
      >
      > var url =
      "http://search.yahooapis.com/SiteExplorerService/V1/inlinkData?" +
      >
      "appid=3wEDxLHV34HvAU2lMnI51S4Qra5m.baugqoSv4gcRllqqVZm3UrMDZWToMivf5BJ3Mom"
      +
      > "&results=20&output=json&omit_inlinks=domain" +
      > "&callback=YAHOO.example.Retry.callback" +
      > "&query=" + encodeURIComponent(what);
      >
      > var o = Get.script(url, {
      >
      > // executed by the get utility
      > onSuccess: function() {
      >
      > // The callback should have been executed at
      this point, so 'done'
      > // should be true. Try again if not. You may
      want to do this in a
      > // timeout if the FireFox bug also introduces a
      timing issue.
      > if (!done) {
      > var query = processing;
      > processing = null;
      > YAHOO.example.Retry.fetch(query);
      > }
      > }
      >
      > });
      > };
      > };
      > }();
      >
      > -Adam
      >


      Your code should work if FireFox "knows" it is connected again but in
      my case I can see the request and response in FireBug but the response
      isn't being executed not matter how many time I retry.
    Your message has been successfully submitted and would be delivered to recipients shortly.