Support » Plugin: Easy FancyBox » [Plugin: Easy FancyBox] PDF links open in browser, not in lightbox

  • Resolved Bucifal


    Hello, I seem to have an issue with pdf links, as they open in the browser and not in the lightbox, regardless of what I try.

    This is what I’ve done so far, so that you can have a better idea of the issue:
    – tried the test links provided in the other topics ( and I can open all the pdfs so the issue is not with my browsers (Opera and Chrome, latest builds); a couple of friends experienced the same thing, they could see the embeded links in the test site, but my links were opened via browser;
    – tried both the class=”fancybox-iframe” and class=”fancybox-pdf” versions while having autodetect disabled
    – tried the plain link to the pdf and have it autodetected
    – tried using Google Viewer without luck (even with the code from their website)
    – tried enabling the iframe, but still didn’t work

    Other useful details:
    – the syntax used for the links: Title
    – I use a couple dozen plugins and I will try disabling each of them to see if there’s an incompatibility (most likely, as I think I used all possible options I could think of) somewhere as the local test run was made on a vanilla WordPress install, apart from the NextGen Gallery and the Easy FancyBox.

    If you have any suggestions, please let me know. The webpage in question can be found here – MA CEAS and TOEFL links.

    Thanks in advance for your time!

Viewing 14 replies - 1 through 14 (of 14 total)
  • After removing a couple of plugins, the syntax worked! Both the autodetect and the iframe/pdf classes work.

    In conclusion, for other users that will see themselves in my shoes, check your plugins if the rest of the settings are in order 😀

    Thank you very much for this excellent piece of software.


    Plugin Author RavanH


    Excellent 🙂

    Do you know which plugin conflicted, by any chance?

    I’ve absolutely no idea 😀 I removed the excess plugins that I didn’t actually need on the blog and everything seems to have been fine since then. No problems whatsoever.

    Had the same Issue with the Plugin “Google Maps Widget” – will see if I can fix it to continue using both.

    nevertheless thanks Ravan! 🙂

    Plugin Author RavanH


    Hi Jonas, do you have a link to a live example where both plugins are running together?

    not yet online, sorry
    Google Maps Widget also uses a version of fancybox, but i didn’t find a way to fix it that both work..

    Plugin Author RavanH


    Hmmm… looks like that plugin includes the fancyBox2 script which is not GPL licenced. Including software licenced other than GPL is against WP Extend repository policy.

    Anyway, it includes this script with a very particular slug name. That’s why my plugin does not recognise and work around it. But knowing the correct slug name, in theory I could make my plugin work around that too. Only problem is that that will probably break the GMW plugin script parameters since those are for fancyBox2 and not for FancyBox (1.3.4)

    Meanwhile i’ve found another solution for the maps widget (“Google Maps Lite”) This one has no lightbox, but thats not really neccesary for my use.

    One other problem i’ve noticed is that mobile browsers often crash on viewing pdfs in the fancybox (and if not scrolling is not possible) Is this a problem with the pdf plugins of the browsers (Mobile Safari and Chrome in fact) or can we fix this?
    Shall i better create a new Thread about this?

    Thank you for your support

    Plugin Author RavanH


    Do you see these browsers crashing only when embedding PDFs in FancyBox or also wen embeded straight in the page with iframe or object tags?

    I’ll do some testing if I get some time for it…

    The other ways work less or more, but the scrolling is always weird to not possible..
    I think the best for mobile devices would be to open the pdfs just in a new tab that the user can see them in fullscreen and the browser can handle them as it always does..

    Is it possible to add an exception for mobile browsers to the pdf-autodetect feature?

    Plugin Author RavanH


    I’ll think about it and if I find a way that does not involve building a complete extra plugin to do this it will make it into a new release. But I cannot promise anything soon.

    okay i’ve hacked it in myself now, if somebody has the same problem:

    Add this to line 796 in the fancybox js (and edit the php in line 395 to use the not-packed script):

    var isMobile = {
    			    Android: function() {
    			        return navigator.userAgent.match(/Android/i);
    			    BlackBerry: function() {
    			        return navigator.userAgent.match(/BlackBerry/i);
    			    iOS: function() {
    			        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    			    Opera: function() {
    			        return navigator.userAgent.match(/Opera Mini/i);
    			    Windows: function() {
    			        return navigator.userAgent.match(/IEMobile/i);
    			    any: function() {
    			        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
    				if ($(this).is('a[href$=".pdf"]') && isMobile.any()){return;}

    thats not really the great way to do it because its in the fancybox script itself, but for now it works 🙂

    Plugin Author RavanH


    Hi Jonas, would you mind if I take your code and use it (in some form) in the plugin?

    nope, thats why i posted it here 😉

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: Easy FancyBox] PDF links open in browser, not in lightbox’ is closed to new replies.