1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Force PDFs in lightbox

Discussion in 'Programming' started by rsny, Mar 30, 2013.

  1. #1
    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:

    <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>
     
    
    Code (markup):
    And the links themselves are written as:

    <a href="filename.pdf" class="bump" rel="850-550">
    HTML:
    Any suggestions for forcing the PDF display through Bumpbox instead of potentially being downloaded based on user settings? Thanks!
     
    rsny, Mar 30, 2013 IP
  2. CodeShop

    CodeShop Active Member

    Messages:
    137
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Okay, I see that it is coded in mootools. The best method is to check javascript error console box in chrome or FF. You can find js errors and reason of those errors in error console box. If you will unable to fix the issue please share the console log with me and I will be glad to help you with this simple issue. Thanks.
     
    CodeShop, Apr 1, 2013 IP
  3. rsny

    rsny Member

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #3
    Thanks but it's not a mootools problem or an error. As I said, it's a matter of overriding browser settings. Apparently, it can't be done since PDFs are completely dependent on the user's personal settings. I've just gone ahead and used Bumpbox as before, but included a note on the page that if the lightbox shows up empty, it's likely been downloaded per their browser settings. Seems that's the best I can do for now, since there's no other format I can find that works for displaying my writing in that way.
     
    rsny, Apr 3, 2013 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #4
    Given how badly PDF's suck on a website, why would you? PDF's are by design meant for print, not screen.... and even if you have a massive screen they still for the most part SUCK, BAD. you want it on the page, turn it into markup -- otherwise, I'd be FORCING it as a download so a PDF viewer that doesn't suck (as bad) can be used.
     
    deathshadow, Apr 4, 2013 IP
  5. rsny

    rsny Member

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #5
    Well, that's really a matter of opinion....it looks great in Bumpbox, in my opinion, because you completely control how it displays. If you can suggest an alternative format that will allow me to copy text from Word, place it into a file that can't be directly edited, without losing the formatting (as tends to happen when converted to htm, etc.) then I'm quite happy to try something new. But until then, I haven't found any viable alternatives to the PDF format for displaying these kinds of writing samples.
     
    rsny, Apr 4, 2013 IP
  6. rolodex

    rolodex Well-Known Member

    Messages:
    364
    Likes Received:
    37
    Best Answers:
    5
    Trophy Points:
    175
    #6
    I can think of one. Converting them to image. It can't be directly edited, doesn't lose the formatting. Hehe. But then comes the problem of multiple pages = multiple files. Maybe that's how they read graphic novel/manga online.
     
    rolodex, Apr 4, 2013 IP
  7. rsny

    rsny Member

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #7
    Yeah, I actually considered and began the process of converting the PDFs to images at one point and it just wasn't practical. We're talking 15-20 pages for some of the files and it's a major inconvenience and doesn't look as nice. Honestly, displaying the PDFs in Bumpbox is the best solution I found after lots of trial and error...and although it isn't totally ideal, as long as I include a note about browser settings (so that if the lightbox DOES come up empty, they know what happened), it's the cleanest and nicest option so far.
     
    rsny, Apr 4, 2013 IP