fancybox makes multiple request on iframe is used ?

876 views
Skip to first unread message

Elvis

unread,
Mar 12, 2010, 6:14:12 PM3/12/10
to fancybox
Hi guys,

I'm using fancybox to open an url in a iframe.

The problems is that in my apache log i can see that the url was
requested multiple times, for a single click.

A have also tested with the example from
http://fancybox.googlecode.com/files/jquery.fancybox-1.3.1.zip, by
replacing the ajax.txt with a file named ajax.php that only shows a
random number.

Here are 2 entries from my log file :

192.168.119.1 - - [12/Mar/2010:10:37:16 +0200] "GET /
prototype.com.local/web/jquery.fancybox-1.3.1/ajax.php HTTP/1.1" 200
25 "http://192.168.119.128:8080/prototype.local/web/
jquery.fancybox-1.3.1/" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-
US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/
532.5"
192.168.119.1 - - [12/Mar/2010:10:37:16 +0200] "GET /
prototype.com.local/web/jquery.fancybox-1.3.1/ajax.php HTTP/1.1" 200
25 "http://192.168.119.128:8080/prototype.local/web/
jquery.fancybox-1.3.1/" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-
US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.89 Safari/
532.5"

Tested in Firefox / Google Chrome for browser and Apache2 /
LightHttpd, so it's not a browser thing ..

How can I prevent this from happening ?

Raine L.

unread,
Mar 15, 2010, 2:10:34 PM3/15/10
to fancybox
I'm seeing this same thing happen with an .Net application. It's
causing multiple loads of the same page when displaying in an iFrame.
I've checked to make sure it wasn't because of a image missing or
anything.

-Raine

On Mar 12, 4:14 pm, Elvis <apostolel...@gmail.com> wrote:
> Hi guys,
>
> I'm using fancybox to open an url in aiframe.
>
> The problems is that in my apache log i can see that the url was
> requested multiple times, for a single click.
>

> A have also tested with the example fromhttp://fancybox.googlecode.com/files/jquery.fancybox-1.3.1.zip, by

ke...@bloompark.de

unread,
Apr 22, 2010, 5:17:34 AM4/22/10
to fancybox
The problem seems to be the generation of the iframe before it is
appended to the inner-div.

In fancybox_start() the iframe is being generated via:
$('<iframe id="fancybox-frame" name="fancybox-frame' + new
Date().getTime() + '" frameborder="0" hspace="0" scrolling="' +
selectedOpts.scrolling + '" src="' + selectedOpts.href + '"></
iframe>').appendTo(tmp);

Afterwards in fancybox_show() the contents of tmp is copied to
"inner":
inner.(....).html( tmp.contents() );

In firefox this leads to calling the url twice while e. g. in IE no
such problems occur.

We resolved this issue by generating the iframe-tag directly in the
inner.(...).html():

.html( ( ( isIframe==true ) ? '<iframe id="fancybox-frame"
name="fancybox-frame' + new Date().getTime() + '" frameborder="0"
hspace="0" scrolling="' + selectedOpts.scrolling + '" src="' +
selectedOpts.href + '"></iframe>' : tmp.contents() ) );

We added isIframe as a paremeter to fancybox_show(), it is only set in
iframe-fancybox_show()-call.

Other/better solutions?

Greetings
Martin
--
You received this message because you are subscribed to the Google Groups "fancybox" group.
To post to this group, send email to fanc...@googlegroups.com.
To unsubscribe from this group, send email to fancybox+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/fancybox?hl=en.

Reply all
Reply to author
Forward
0 new messages