Login Register

ContentPane setHref Redirect Detection

Hey all,

I'm using ContentPanes in my application, and I use the setHref() function to update the content at various times. All works well, but I run into an issue if the user's session times out, because the server will redirect the request to the login page and the login page will end up being displayed inside my ContentPane widget, which is definitely not what I want and ends up breaking my layout pretty badly.

Is there an easy way to listen for these ContentPane loads so that I can check the content and make sure it isn't my login page? Ideally I'd like to do this for all ContentPanes in the application, but if I need to set up a listener for each ContentPane individually I could do that too...

Thanks,

Chris

you can do it manually with

you can do it manually with xhrGet instead of .setHref directly. something like:

dojo.xhrGet({ 

   url: myUrl,
   handleAs: "text",
   load: function(data,ioArgs){ 
          // determine here if the data is login page or real data somehow
          if(realData){
            theDijit.setContent(data); // as opposed to setHref(myUrl)
          }else{
            //redirect to login page or whatever
          }
   },
   error: function(){
          // redirect isn't an error, this is here in case there actually is an
          // error.
   }

});

Thanks...I guess I will use

Thanks...I guess I will use that instead of setHref

- Chris

w3c

Hi,
I had the same problem, w3c specification says that redirect is hidden to client.
One solution is that indicated by Cris_Dojo.