Request sent to server during onclick event

Page: 1

Author Post
shantz1
Guest
Hi, I have been using lytebox for a while now, but noticed that it has some issues with IE8. When I went to see if he had any updates he said it was dead and recomended you. So far I am very impressed. I really like the improvements available over lytebox. However I am having one issue.

When I click on the image floatbox seems to work prefectly. The problem is that when the click happens a request is sent back to my server. Becuase of this request variables are reset so my server state acts as if a new page has been requested.

Is there a way to stop this request being sent when a click happens. Below are the steps to reproduce. I will email you my site if you need to take a look.


1. Browse to the site.
2. Close the first image.
3. Select a differnt date (April 3rd).
4. View and image.
5. Close an image.
6. Click the next button bellow the images.

here you will notice it swithes days. This is because my state was lost from the request sent by the onclick event.

Thanks for the help.

PS. I don't know if this helps but the request happens as soon as the floatbox is finished animating.
Administrator
Registered: Aug 2008
Posts: 3382
You can't turn off a browser sending a get request for images it is displaying. (You can't display an image without getting it.) Your state management strategy is going to have to handle the fact that those gets will occur. (Maybe keep the currently selected date in a session var???)
shantz1
Guest
Sorry I wasn't very clear. I realize a request must be sent for the image. The issue is that a request is being sent for Default.aspx. This request is what is messing with my state.

I don't know if it helps but this site has been working correctly with lytebox for almost a year. If you would like to see an example of that try.

www

dot

amyandtodd

dot

net

Thanks for the help.
Administrator
Registered: Aug 2008
Posts: 3382
Your site is currently using lytebox, not floatbox, so there's no much I can do by looking at it.
But there's nothing in floatbox which would cause a re-get of the host page when displaying an image.

I wonder though about the target attributes on your anchors. For example, target="SaveFileAs.aspx?Image=Photos\_0_2008\_12_December\date-2008-12-17\12-17-2008%2006-48-06%20PM.JPG"
I'm not familiar with any syntax or use for the target attribute that would look like yours, but maybe that is causing the document fetch???
sirgwain
Guest
Hi,

I am seeing the same behavior when transitioning from lytebox to floatbox.

I am running my webserver in python using cherrypy. When I click on an image in a group it shows me the image, then sends a request back to the app. This isn't a static image request to fetch the image.

Here is the log of the request:

2009-04-09 10:48:03,746 - cherrypy.access.19258416 - INFO - 127.0.0.1 - post [09/Apr/2009:10:48:03] "GET /pictures/2009/2/27/Making_Tea HTTP/1.1" 200 3626 "http://localhost:8000/pictures/2009/2/27/Making_Tea" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16"


The anchor causing this is formatted like so:

<a title=""
rel="floatboxGroup"
href="/pl/2009/02 - February/2009 - 02 - 27 - Making Tea/_800/DSC_8178.jpg">


I've put in some debugging and the onclick event appears to be returning false:

It's definitely getting to this return false below: (line 381: floatbox.js)

if (!(e && (e.ctrlKey || e.metaKey || e.shiftKey)) || a.revOptions.showThis === false || !/img|iframe/.test(a.type)) {
fb.start(this);
if (this.ie && e) e.returnValue = false;
return false;
}
shantz1
Guest
I sent you an email last night with my live site in it that is using floatbox. The site in the last post was just to demonstrate that lytebox was working correctly. The target attribute is something I added to lytebox. I added a save button that linked to the full size image to be saved for printing. I have removed that attribute from my floatbox site because I was worried it might be causing the problem.

If I can get float box working I was planning on adding the save feature. I can pass it back to you at the time if you like.
Administrator
Registered: Aug 2008
Posts: 3382
I'm seeing a similar unexpected get request on my test site. So far I'm completely baffled about where it might be coming from, but stay tuned. I'll slice and dice until I sort it out.
Administrator
Registered: Aug 2008
Posts: 3382
Found it. It's a real bone-head coding mistake on my part. :oops:

In floatbox.js, (line 2005?) find:
that.fbZoomImg.src = '';
Delete (or rem out) that line.
(framebox.js too if you use that.)

Thanks for your persistence in reporting this and help in finding it.
sirgwain
Guest
Great! That worked for me. Thanks for looking into it so quickly. Floatbox is very deluxe. The sheer amount of flexibility and cool features is amazing.

btw, 'rem out'? I haven't heard that term since writing DOS batch files. :)

Page: 1