[resolved] Open link in new tab (6 posts)

  1. burneyrg
    Posted 3 years ago #

    There is a word on one of my pages that I would like to link to a pdf file in the library and have it open in a new tab. How?

  2. catacaustic
    very awesome
    Posted 3 years ago #

    In the links HTML code you need to add target="_blank". So, it would look something like this:

    <a href="myfile.pdf" target="_blank">Link</a>

    You might hear from others about how forcing users to open links in new tabs/windows is bad usability, but I'm not quite as rigid as that. I know there's always a time and place for things like this.

  3. burneyrg
    Posted 3 years ago #

    The path to my file is: themes/twentyeleven/assets/Bylaws.pdf. I also put it into the MEDIA library. THe link appears on my page, but the pdf file downloads and does not open. Various iterations of the link have been universally unsuccessful. Some will open a new tab with "File not found" error. Most just download the file.
    Yes, I really want it to open in a new tab. Don't go there.

  4. catacaustic
    very awesome
    Posted 3 years ago #

    What you're saying there is 99.999% of the time to do with the browser that you're using. There's settings in the browser that tell it what to do with files like that, and in your case it's being told to download the file instead of displaying it in the browser window.

    That's something that you can't contorl on anyone elses browser. Settings like that are not available to a website because it could lead to a lot of security vunerbilities.

  5. burneyrg
    Posted 3 years ago #

    You realize, of course,that:
    1. You're correct.
    2. You're depressing me. Spent two digit hours today trying to get it to work in Firefox. Worked first time just now in Safari. Damn!!

    And I don't see any way to set this on my version of Firefox.

  6. catacaustic
    very awesome
    Posted 3 years ago #

    Sorry. I know that it sucks, but that's how it goes with things like this. There's ways to get around that, but it invloves a lot of programming work to force the HTTP headers to say the right thing to force the file to be displayed inline. It's somewhat hard to do though.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.