WordPress.org

Ready to get started?Download WordPress

Forums

Easy FancyBox
[resolved] PDF links open in browser, not in lightbox (15 posts)

  1. Bucifal
    Member
    Posted 1 year ago #

    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 (http://demo.status301.net/easy-fancybox-sandbox/pdf-embeds/) 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!

    http://wordpress.org/extend/plugins/easy-fancybox/

  2. Bucifal
    Member
    Posted 1 year ago #

    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 :D

    Thank you very much for this excellent piece of software.

    Cheers!

  3. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    Excellent :)

    Do you know which plugin conflicted, by any chance?

  4. Bucifal
    Member
    Posted 1 year ago #

    I've absolutely no idea :D 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.

  5. Jonas90de
    Member
    Posted 1 year ago #

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

    nevertheless thanks Ravan! :)

  6. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

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

  7. Jonas90de
    Member
    Posted 1 year ago #

    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..

  8. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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)

  9. Jonas90de
    Member
    Posted 1 year ago #

    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

  10. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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...

  11. Jonas90de
    Member
    Posted 1 year ago #

    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?

  12. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  13. Jonas90de
    Member
    Posted 1 year ago #

    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 :)

  14. RavanH
    Member
    Plugin Author

    Posted 1 year ago #

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

  15. Jonas90de
    Member
    Posted 1 year ago #

    nope, thats why i posted it here ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic