Open attachments in new window.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BugOutGirl
    Senior Member
    • Feb 2015
    • 129
    • 5.1.x

    Open attachments in new window.

    I want attachments to open in new window/tab, not sure how to do that. Right now when you click attachment, it opens in the same window as the forum. I've looked everywhere and can't seem to find out where to change this. Please let me know if this is possible. Thanks!
  • glennrocksvb
    Former vBulletin Developer
    • Mar 2011
    • 4021
    • 5.7.X

    #2
    There are 2 ways to do this while there's no official fix from vB.

    1. Edit bbcode_attachment_list template

    Change:

    Code:
    <a href="{vb:raw attachurl}{vb:raw attachment.nodeid}">
    to:

    Code:
    <a href="{vb:raw attachurl}{vb:raw attachment.nodeid}" [COLOR=#FF0000]target="_blank"[/COLOR]>

    2. Create a template hook in footer_before_body_end hook location with this script to dynamically add link target. Similar instructions on how to create a template hook can be found on one of my mods in my signature below.

    Code:
    <script>
    (function($) {
        $('.b-post-attachments__item a').attr('target', '_blank');
    })(jQuery);
    </script>
    #2 is the recommended solution. Editing templates (#1) is not recommended for maintenance reason. Your template changes might get overridden during upgrades or may have merge conflict that you have to resolve.

    Flag Icon Postbit Insert GIPHY Impersonate User BETTER INITIALS AVATAR Better Name Card Quote Selected Text Bookmark Posts Post Footer Translate Stop Links in Posts +MORE!

    Comment

    • Craig
      Senior Member
      • Jan 2008
      • 998
      • 6.X

      #3
      Any idea if this is an improvement request via jira, yet?

      This is a nice idea.
      adktramping ~ my happy place.

      "Whoever said practice makes perfect was an idiot. Humans can't be perfect because we're not machines." ~ Sam Gardner.

      Vote for your favorite feature requests and the bugs you want to see fixed.

      Comment

      • BugOutGirl
        Senior Member
        • Feb 2015
        • 129
        • 5.1.x

        #4
        Thanks Glen, I'll give that a try! (#2)

        Cheers.

        Comment

        • Mark.B
          vBulletin Support
          • Feb 2004
          • 24287
          • 6.0.X

          #5
          Originally posted by NumNum
          Any idea if this is an improvement request via jira, yet?

          This is a nice idea.
          Raise it anyway....if it's a duplicate they'll close it and link to the original.
          MARK.B
          vBulletin Support
          ------------
          My Unofficial vBulletin 6.0.0 Demo: https://www.talknewsuk.com
          My Unofficial vBulletin Cloud Demo: https://www.adminammo.com

          Comment

          widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
          Working...