Fancybox return "The requested content could not be downloaded. Please try again later."

Using Fancybox to play YouTube videos in a modal box .

My problem is that I keep getting "The requested content could not be downloaded. Please try again later."

A modal block will appear, so I know the script is working, it could be a problem with my API call ... here is my call:

<script type="text/javascript"> $(document).ready(function() { /* This is basic - uses default settings */ $("a.fancybox").fancybox({ 'hideOnContentClick': true }); /* This is a non-obtrustive method for youtube videos*/ $("a[rel=fancyvideo]").fancybox({ overlayShow: true, frameWidth:640, frameHeight:360, }); }); </script> 
+7
source share
4 answers

Do you have <a> with class="fancybox" and rel="fancyvideo" ? If you do this, you will bind Fancybox to these elements twice, and Fancybox may not like it. Try using this:

 $("a.fancybox").fancybox({ 'hideOnContentClick': true }); 

And look what happens to only the second in place.

UPDATE : weird. The demo (http://chadly.net/demos/video-lightbox.html) creates different HTML files than your page, the demo creates <object data=...> , but yours creates <object><embed src="youtube-url"> thing. You speak:

 type: 'swf' 

in your Fancybox binding where the <object><embed>...</embed></object> stuff comes from. However, href points to the plain old YouTube watch page for YouTube and that href ends up as an src attribute for <embed> . The URL for embedding a YouTube video does not match the HTML video page and is probably the source of your problem.

Try replacing href , which looks like this:

 http://www.youtube.com/watch?v=QmVvgSfdmJQ 

with such as this:

 http://www.youtube.com/embed/QmVvgSfdmJQ 

The first is a simple HTML page for YouTube, the second is an embedded SWF.

UPDATE 2 . The example that you work for Fancybox 1.0.0, but you are using 1.3.4, 1.0.0, there are special checks for YouTube that are not available in later versions:

 //... } else if (url.match(/youtube\.com\/watch/i)) { //... 

Which of 1.0.0 and the code after that else if rewrites the URL of the HTML page (for example, http://www.youtube.com/watch?v=QmVvgSfdmJQ ) to the old embedded SWF URL (for example, http://www.youtube.com/v/QmVvgSfdmJQ ). This version issue also explains why the demo created different HTML files than yours.

So, you have version issues on top of everything else.

+7
source

Check if you included jquery.fancybox-media.js

 <script type="text/javascript" src="jquery.fancybox-media.js?v=1.0.0"></script> 
+2
source

It looks like your code might be a bit off

 <script type="text/javascript"> $(document).ready(function() { $("a[@rel*=fancyvideo]").fancybox({ overlayShow: true, frameWidth:640, frameHeight:360 }); }); </script> 

http://chadly.net/post/2009/01/29/Lightbox-for-YouTube-Videos.aspx

+1
source

use this sample don't forget href

 <a class="fancybox" href="your path for image or other"> <img src="imagepath"> </a> 
+1
source

All Articles