WordPress.org

Forums

Advanced AJAX Page Loader
[resolved] Links to downloadable documents not working (5 posts)

  1. euphoriuhh
    Member
    Posted 3 years ago #

    Hey - I've come across an interesting issue. I haven't had time to dig in yet but figured I'd mention it.

    I have a few links to PDFs that people need to download / view.

    However, when you click on the link, it tries to pull it in as a normal link via ajax and as thus just spins and spins.

    You can see what I mean at http://whatthefestival.com/get-involved/vendors/merch-vending-application/

    Is there any way to force the browser to download the document and/or bypass the AJAX loading?

    Thanks so much.

    http://wordpress.org/extend/plugins/advanced-ajax-page-loader/

  2. travisavery
    Member
    Posted 3 years ago #

    I am REALLY not sure if this will solve your problem at all, but it may be worth a try. I haven't tried it out with AAPL yet, so it may not even help.

    However this is a little trick I have used in the past to force the browser to download file of a specific type instead of loading them inline.

    Add this to your .htaccess file and replace "pdf" with whatever file type you are trying to force download. Mind you, this will make it so the browser will download ALL files of this type on your server, so make sure it is what you want.

    <FilesMatch "\.(?i:pdf)$">
      ForceType application/octet-stream
      Header set Content-Disposition attachment
    </FilesMatch>
  3. travisavery
    Member
    Posted 3 years ago #

    Another option might be to just make it so target="_blank" when linking to it. That seems to work for loading images.

  4. euphoriuhh
    Member
    Posted 3 years ago #

    Thanks Travis!

    I was trying to stay away from the .htaccess hack.

    As it turns out, I realized that links to pdfs on external domains were not exhibiting the issue. I then added a www. in front of the pdf url and it worked as expected.

    A little bizarre but hey, whatever! ;) Feel free to Resolve. Thanks!

  5. Dean Williams
    Member
    Plugin Author

    Posted 3 years ago #

    .htaccess idea would not do anything, since the user is not being by any headers because javascript is making the connection and fetching the data directly, outside of the browser.

    target="_blank" I believe might not work either.

    In the next version of AAPL, there will be an excludes box where you can put the rule ".pdf". So stay tuned :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced AJAX Page Loader
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic