How to make Attachments Open in a New Window

put this code in the< div id="Foot" > section of your theme's default.master.php , if you use tpl (smarty), add { literal } script{ /literal } . You can use this for any links you want to open in a new window. just add them. Remove the spaces I added between < > so it would show here but you remove the spaces or it won't work..

Comments

I've searched for a solution and tried code after code trying to get embedded images to open in a new window when you click on them. Now I'm referring to images embedded within the body, not attachments via FileUpload. Attached is a link to a vanillaforums.com discussion about this topic with a post by Mark O'Sullivan about half way down with an embedded image that opens in a new window when clicked, not opening in the current window and blocking the whole screen.

I believe that this is the .js file that needs to be edited, only I don't know how to make the image open in a new window when clicked rather than just open in the current window providing an awkward full size image.

When I change it to this code, clicking the embedded images opens the enlarged image, albeit not in a new window but that is fine with me, however, the images are not shrunk to fit the window within the post. Anybody know how to fix that?

Sorry for the massive amount of posts, this is apparently my version of thinking out loud. I've solved the issues posted above, only can't get the image to fit within the frame of the discussion table. Attached is my Vanilla forum with the images overlapping.

Could you please post the solutions you have adopted to solve them? I'm sure they can be useful to other people.

Certainly, to fix the issue of large embedded images opening in the current frame and blocking everything out, I simply looked at the source code to the post mentioned above and pulled out a bit of javascript.

I replaced the very last section of code in the global.js file that I referenced in my second comment above (starting with that jQuery(window) heading) with the code I found in the source code that I referenced in my third comment above (also starting with that jQuery(window) heading but is a little bit longer). This solved my problem of images not opening in a new window.

To fix the framing issue, I used @vrijvlinder 's advice and added this to my theme's custom.css: