Results 1 to 9 of 9

Thread: Force PDF files to open new tab

  1. #1
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    461
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default Force PDF files to open new tab

    Hi, i have problem with PDF Files, even i already target the file _blank. The browser still automatically download the pdf files.
    Is there HTACCESS code to block this feature?
    Last edited by davelf; 04-04-2013 at 05:24 AM.
    _____________________

    David Demetrius // davejob
    _____________________

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    No, not really. Different browsers behave differently and you shouldn't try to control them. There might be some tricks (I've seen more for forcing downloading, rather than by default not downloading), but they won't work 100%.
    Are you trying to make this work just on your own computer or for some visitors (in certain browsers)? It might be possible. If not, there's no real point-- some browsers don't have PDF readers for example.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    461
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    i'm trying to make this work on all computer.
    Well i find this rules:
    1. .htaccess file
    browser will likely open this file directly:
    AddType application/pdf

    and files described as this, browser most likely will DL and save:
    AddType application/octet-stream .pdf

    But like you already said in some browser it does't work.
    _____________________

    David Demetrius // davejob
    _____________________

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    This is something users can decide. For example, I've set my browser to always download PDFs. I don't like to use the in-browser PDF reader.

    It's fine to suggest that they should use a new window and view it in the browser (actually, I think this is the default in almost all browsers, but maybe not a new window), but don't try to force it if that's not what the user wants.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. The Following User Says Thank You to djr33 For This Useful Post:

    davelf (04-03-2013)

  6. #5
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by djr33 View Post
    This is something users can decide. For example, I've set my browser to always download PDFs. I don't like to use the in-browser PDF reader.

    It's fine to suggest that they should use a new window and view it in the browser (actually, I think this is the default in almost all browsers, but maybe not a new window), but don't try to force it if that's not what the user wants.
    Agreed. Keep in mind that some browsers (or browser+OS combinations) aren't even capable of opening a PDF - you'd cause problems trying to force it.

  7. #6
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    2,038
    Thanks
    16
    Thanked 316 Times in 314 Posts
    Blog Entries
    13

    Default

    Yup - Blackberry devices cant open PDF and there is currently no free app to download that allows that facility.
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  8. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    iPads/iPhones can only view PDFs in a browser window. (So, yes, it varies a lot especially on mobile devices.)
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  9. #8
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    2,038
    Thanks
    16
    Thanked 316 Times in 314 Posts
    Blog Entries
    13

    Default

    Since I got my iPhone, I've been reading them via DropBox. PDFs are a complete pain in the behind! LOL
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  10. #9
    Join Date
    Jul 2009
    Location
    Binus University
    Posts
    461
    Thanks
    78
    Thanked 21 Times in 21 Posts

    Default

    Ok, thanks for the advice everyone.
    I'll just leave it, with default settings.
    _____________________

    David Demetrius // davejob
    _____________________

Similar Threads

  1. Force a web page to open in new window/tab???
    By spiper in forum Looking for such a script or service
    Replies: 4
    Last Post: 01-21-2013, 02:43 PM
  2. Resolved Force link to download image not open
    By davelf in forum HTML
    Replies: 6
    Last Post: 05-31-2012, 04:17 AM
  3. Accordion Content - Force Header To Stay Open
    By lahue in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 02-21-2011, 07:26 PM
  4. Force URL to open as IFrame in outside URL
    By MJensen in forum JavaScript
    Replies: 80
    Last Post: 01-14-2008, 10:25 PM
  5. Replies: 0
    Last Post: 07-18-2006, 06:17 AM

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
  •