3

Is there any easy way to open the document library files in a new window or popup depending on the file types?

e.g. PDF - In Adobe reader (currently opens in IE)

Image file (currently opens in IE)

2

I used the below to do this.

<script type="text/javascript">
$(document).ready(function(){
$('.s4-ba a').attr("target", "_blank")
$('.s4-ba a').removeAttr("onclick");
});</script>
0

It can be possible to open files in new window in Internet Explorer itself, have to modify little bit XSLT (as need to add _blank='true') in ListViewWebpart embedded in list view page itself.

Yes, design mode is not available. I am not saying to open design mode.

  1. Open library in sharepoint designer.
  2. Click 'Advanced' in Home tab.
  3. Markup will be visible, select the XsltListVievWebpart tag from start to end
  4. By doing 3) step, a new tab appear named "List View tools".
  5. Within that tab go to Design options and click 'customize xslt'
  6. Check xsl will now render, search by Verifyhref
  7. Add _blank='true' there.

After the operation performed from screenshot, perform step 6 and 7 and do preview the page in browser from SPD itself.

Here are some screenshots:

First part First PArt

Second partSecond part

  • what about SharePoint 2013 i don't get control over view? – Hardik Kothari Sep 22 '14 at 8:43
  • SharePoint 2013 has given us a property JSlink to modify our view as we need to do so. But in that case you to written a bit javascript decorating your view in html and giving link to document as anchor tag with '_blank' property. Else than I think, xslt is the only way with SharePoint designer – ateet Sep 22 '14 at 8:49
  • not getting the exact property to place "_blank". let me know if you have any – Hardik Kothari Sep 22 '14 at 9:06
  • Do one thing instead of that, go to document library settings page> Advanced settings>Opening Document in Browser>Choose-Open in client application – ateet Sep 22 '14 at 9:59
  • yes tried it, it doesn't work – Hardik Kothari Sep 22 '14 at 10:00
0

This is a web app wide setting or a doc lib specific etting. In Central Admin (or through Powershell), change file handling for a web application:

https://community.colligo.com/entries/23392255-How-can-I-enable-the-option-to-open-a-file-from-SharePoint-

$web  = Get-SPWeb http://yourspweburl
#Get Document Library
$docLib = $web.lists["Your Document Library Title"]
#If you need to change it from Strict to Permissive
$docLib.BrowserFileHandling = "Permissive"
$docLib.Update()
  • Please don't add the exact same answer to this question, as you did on this one. Instead, try to specify your answer further to make it a better of this specific question. Thank You! – Benny Skogberg Feb 16 '16 at 20:11
-1

It's working for me in SharePoint 2013

http://www.benramey.com/2011/04/25/opening-all-sharepoint-2010-documents-in-a-new-window/

Insert a content editor and add the following code,

$(document).ready(
function () {
    // has to be on an interval for grouped doc libraries
    // where the actual links are loaded only once a group
    // is expanded
    setInterval(
        function () {
            $("a[onclick*=’return DispEx’][target!=’_blank’]")
                .attr("target", "_blank")
                .removeAttr("onclick");

            // document type icons
            $("td.ms-vb-icon>img[onclick]:not([documentUrl])")
                .click(function (e) {
                    window.open($(this).attr("documentUrl"), "_blank");
                    e.stopPropagation();
                    e.preventDefault();
                    return false;
                })
                .each(function () {
                    $(this).attr(
                        "documentUrl",
                        $.trim(String($(this).attr("onclick"))
                            .split("=")[1]
                            .replace(/["'{}]/g, "")
                            .split(";")[0])
                        );
                    this.onclick = null;
                });
            },
            500
    );
}

);

  • Please don’t add just a link as answer to a question. If the link breaks, the answer you provided will not be useful for future visitors. Provide an answer of your own and use the link as reference. If needed, you can block quote the content from your link. More information is found in our help center, especially How do I write a good answer – Benny Skogberg Feb 16 '16 at 20:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.