FF 3.0.5 tab loading after closing floatbox

Page: 1

Author Post
conor
Guest
Hi,

I am experimenting with floatbox at the moment.
It is a great utility but I have one problem for which I have not found a solution in the forums.

When I close a floatbox window using onclick it works fine.
But if I call it from onload or from the href of a link the floatbox window does close but the "loading..." string appears in the firefox tab and the hourglass appears beside the cursor. The tab stays in this state until the page is reloaded or alternatively if I reopen the floatbox window and press the close link.
This problem only occurs in firefox (specifically FF3.0.5).

Can you suggest a way I can get around this problem but still close the floatbox window from the onload event?

Thanks
Administrator
Registered: Aug 2008
Posts: 3382
Hi Conor.
This is really vague. I'm not sure what you are trying to do. When you say "if I call it", what does "it" refer to? It sounds like you are saying you are trying to close floatbox from the onload event, but it makes no sense to do that in any context.

Let me take a stab in the dark on this. If I miss the target (likely), please provide more info about what you are trying to do.

Let's say you are calling the fb.end() function from a onclick action on an anchor within your floatboxed iframe page. If so, make sure you are including "return false" in the javascript statement. This is to cancel the default click action of the href. By your description, it sounds possible that you have not returned false, and consequently the click action is both destroying the iframe window and simultaneously requesting new content for that iframe. I can imagine browsers getting stuck in a "loading..." state under such circumstances.

onclick="parent.fb.end(); return false;"

This has nothing to do with the onload event you are referring to but I'm completely lost about what you are trying to do with that.
conor
Guest
Hi,
Thanks for the quick reply.
Sorry about the confusion.
Basically I am submitting a form from the floatbox window.
The server will return one of two possible pages.
If one page returns I want to just close the floatbox window.
If the other page returns I want to keep it open.

For this reason I am closing the floatbox when the page loads in the first scenario. I have tried "parent.fb.end(); return false;" but as I mentioned in FF the tab stays in the loading state.

Thanks
Conor
Administrator
Registered: Aug 2008
Posts: 3382
The basic problem is you're calling fb.end() when the submit button is clicked. fb.end discards the iframe window so the submission response has nowhere to load. You need to run fb.end() after the response is received, which means you should move it to javascript that is attached to the response page's body.onload or window.onload action. Or, alternatively, if you need to load a new page in the top document after the submission, you could set the onload action to top.location.href = 'page2.html';

Correction: Better to use parent.fb.loadPageOnClose = ' page2.html'; parent.fb.end(); rather than setting top.location.href. This way you'll get the nifty cool animations for the closing floatbox instead of it just going 'poof'. Also, you could try putting the code inline in your returned page instead of attaching it to onload. This should work and, if so, it will fire sooner. Subject to testing, but what isn't???...
« Last edit by admin on Wed Jan 21, 2009 12:18 pm. »

Page: 1