SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Document Library that is grouped by a column "Meeting Name." I should note that this code works on the other Document Libraries, just does not when the grouping is applied. Any suggestions would be appreciated. Thanks!


I've tried the following two methods for getting the pdf to open in a new browser window, but both fail:

function OpenPDFNewWindow() 
    var aAllLinks = document.links;
    for(var i=0;i<aAllLinks.length;i++)
        var oA = aAllLinks[i];
        var sHREF = oA.href.toLowerCase();
        if(sHREF.indexOf(".pdf") > 0)
                 var w =;
                     if(w) {
                         return false;
                 return true;
share|improve this question

When grouping is enabled on SharePoint list view, it does not load information on page load, but do an ajax loading later on group expanding. That is why it works on other standard views without grouping.

So when your javascript runs, there is no links on the page to change. You need somehow to run your script after expand event happened to get it working.

Alternatively you might consider an option to adjust xslt template for view and add onclick attribute there instead of using javascript.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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