I am using SharePoint Foundation 2010 and attempting to have my PDFs open in a new tab or window. I have been able to get this to work from document libraries by using jQuery. You can see this code below. One of the reason I am using this is to avoid the user being prompted for credentials every time they open the a PDF.
$("a[target!='_blank'][href$='.pdf']").attr("target", "_blank").removeAttr("onclick");
I also have Search Server Express 2010 setup on this server. When I try to run this same jQuery code on the results.aspx page it responds different. It is forcing a download of the PDF (the natural action) as well as opening it in a new tab/window (as I have added). I tried to add similar code to this below to prevent the downloading of the PDF. I just want it to open in a new window/tab.
$("a[target!='_blank'][href$='.pdf']").attr("target", "_blank").removeAttr("onclick").click(function (e) {
e.preventDefault();
});
If anybody has any suggestions or pointers, that would be great.