SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Mar 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Force PDFs in Lightbox

    Hi, I've been using Bumpbox to display PDF files on my website in a popup lightbox format. I've been using it for over a year and never had any problems, but just recently it stopped working. An empty lightbox would pop up and the PDF would be downloaded straight to my hard drive.

    I use Firefox and have it set to automatically download most files, including PDFs. However, I don't believe this was a problem before. Since Bumpbox was being used, it would display PDFs in the popup and only downloaded them from direct links on other sites. I changed my PDF settings to "preview in Firefox" and now it's loading in the lightbox just fine. I don't know if it's a result of having updated to the latest version of FF or what, considering I didn't personally change anything since it was last working.

    My concern is that whether or not it displays properly (instead of downloading and leaving users with an empty box on the screen) now seems to be user-dependent. Is there a way to use Javascript or PHP or anything to force PDF files to open in the lightbox (effectively overriding browser settings)? Because it's going to look really unprofessional if I have multiple pages that are supposed to be read on my site and people browsing through it simply end up with an empty lightbox on the screen.

    I recently started redoing the site with Joomla so I don't know if that's causing the problem, although I moved the earlier version (raw CSS/HTML) into a subdirectory, where the overall site functions as it always did, and the same issue is happening there too. So I'm just wondering if it might be an issue with newer browser versions.

    The code placed at the bottom of the page is:

    Code:
    <script type="text/javascript" src="../bumpbox/js/mootools.js"></script>
    
    <script type="text/javascript" src="../bumpbox/js/bumpbox-2.0.1.js"></script>
    
    <script type="text/javascript"> doBump( '.bump',750, 500, '111', '000', '0.8', 5, 1 ,'333', 15,'000', 2,
    
                    Fx.Transitions.Bounce.EaseOut,
    
                    Fx.Transitions.Bounce.EaseOut,
    
                    '',
    
                    'top left',
    
                    'repeat-x' );</script>
    And the links themselves are written as:

    Code:
    <a href="filename.pdf" class="bump" rel="850-550">
    Any suggestions for forcing the PDF to display through Bumpbox instead of potentially being downloaded based on user settings? Thanks!

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,799
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Anything involving PDFs on web sites will always be user dependent. Not everyone installs the plugin that allows the browser to handle the PDF at all.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Member
    Join Date
    Mar 2013
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the quick reply. That is disappointing though...I thought if it used the right script/code, a lightbox popup could be forced. Like with images, even if I have my browser set to automatically download all JPGS, they will still display in lightbox format with the right coding rather than downloading, regardless of my browser settings. I had hoped it would be the same for PDFs, especially since it seemed to be working beautifully for the last year.

    Do you have any thoughts on alternatives? It's basically writing samples from books and stories I'm working on, and I'd really like each excerpt to be displayed in a lightbox-style popup. If there are reliability issues with PDFs, can you possibly suggest another format (the text is originally taken from a Word doc) that would be less dependent on the user? Thanks!

  4. #4
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I faced the same issue with bumpbox to display PDFs, which suddenly stopped working in the expected way.
    I guess you tried it locally, correct ?
    As for unknown reason (at least for me) is this behaviour only seen locally, if opened "via the internet" it's still working correctly.
    You can simply try the PDF examples/demo on the bumbox developer homepage (artViper), that is also still working.

    May this information comes still in time or you found it out by yourself meanwhile, before you realized the PDF handling on a different way.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •