Skip to main content
ExLibris

Knowledge Assistant

BETA
 
  • Subscribe by RSS
  • Back
    Primo

     

    Ex Libris Knowledge Center
    1. Search site
      Go back to previous article
      1. Sign in
        • Sign in
        • Forgot password
    1. Home
    2. Primo
    3. Knowledge Articles
    4. Embed Javascript in footer.html to open View Online Tab, Title link or Thumbnail in a new window.

    Embed Javascript in footer.html to open View Online Tab, Title link or Thumbnail in a new window.

    1. Last updated
    2. Save as PDF
    3. Share
      1. Share
      2. Tweet
      3. Share
    1. Additional Information
    • Article Type: General
    • Product: Primo
    • Product Version: 4

    Desired Outcome Goal:
    Improve the search experience by opening results in a new window when a user clicks on the View Online tab, Title link or Thumbnail in the Primo brief results list.

    Procedure:
    1. Open the default or customized version of the footer.html using a text editor (eg: notepad)

    2. Add the following javascript code to the footer.html file >

    <script type="text/javascript">
    $('h2.EXLResultTitle > a').attr('target','_new');
    $('div.coverImageDiv > a').attr('target','_new');
    </script>

    <script type="text/javascript">
    $('.EXLViewOnlineTab a').each(function(){
    $link = $(this);
    if ($link.attr('title').substring(0, 13)=='viewOnlineTab') {
    $link.parent().addClass("EXLResultTabIconPopout");
    $parent = $(this).parent().parent().parent().parent().parent();
    $a = $parent.find(".EXLSummaryContainer > .EXLSummaryFields > h2.EXLResultTitle > a");
    $parent.children(".EXLContainer-viewOnlineTab").remove();
    $link.attr('target','_new');
    }
    });
    </script>

    3. Save the .txt file with an .html extension eg: footer.html, as a local file.

    4. Upload the customized footer.html file to the Primo server (using the file-uploader tool)

    5. Search Primo to retrieve a list of brief results.

    6. Click on the ViewOnlineTab,Title link,or thumbnail to confirm that results open in a new window.

    Additional Information

    Adding javascript to the static html file to open the Viewit tab in a new window is a common customer request and saves the end user from having to open the i-frame and then click an additional linke to open a new window.

    This solution can be customized at the institution-level in Primo by editing and uploading a custom static html file.

    Key to javascript functions:

    Section #1 - Opens Title link in a new window

    $('h2.EXLResultTitle > a').attr('target','_new');

    Section #2 > Opens thumbnail in a new window

    $('div.coverImageDiv > a').attr('target','_new');


    Section #3 > Opens the View Online Tab

    $('.EXLViewOnlineTab a').each(function(){
    $link = $(this);
    if ($link.attr('title').substring(0, 13)=='viewOnlineTab') {
    $link.parent().addClass("EXLResultTabIconPopout");
    $parent = $(this).parent().parent().parent().parent().parent();
    $a = $parent.find(".EXLSummaryContainer > .EXLSummaryFields > h2.EXLResultTitle > a");
    $parent.children(".EXLContainer-viewOnlineTab").remove();
    $link.attr('target','_new');
    }
    });
    </script>

    Category: Front End- Primo

    Subject: Brief Results - Primo


    • Article last edited: 6/30/2014
    View article in the Exlibris Knowledge Center
    1. Back to top
      • Emails missing the name of the library on the locations section
      • Embedded Search Tab Switch Runs Search in iFrame
    • Was this article helpful?

    Recommended articles

    1. Article type
      Topic
      Community Content Type
      How To
      Content Type
      Knowledge Article
      Language
      English
      Product
      Primo
    2. Tags
      1. 4
      2. Brief Results - Primo
      3. contype:kba
      4. Front End- Primo
      5. Prod:Primo
      6. Type:General
    1. © Copyright 2025 Ex Libris Knowledge Center
    2. Powered by CXone Expert ®
    • Term of Use
    • Privacy Policy
    • Contact Us
    2025 Ex Libris. All rights reserved