Skip to Main Content

Embedding Library Resources in Canvas - Faculty Guide

Library Catalog (PBSC) - Primo VE Keyword Widget

This Widget allows an institution to create the code for a customized Search Box for their Primo VE interface. Libraries will want to use this tool to put a search box on their website or within a LibGuide page.

Library Catalog

The library's catalog will allow you to search a wide range of resources including books, eBooks, articles, and streaming videos.

Library Catalog (PBSC) - Primo VE Keyword Widget - Source Code to Embed

<script type="text/javascript">
function searchPrimo(formId) {
       base64_encoding_map includes special characters that need to be
       encoded using base64 - these chars are "=","/", "\", "?"
       character : base64 encoded
    var base64_encoding_map = {"=":"PQ==", "/": "Lw==", "\\":"XA==", "?":"Pw=="};

    var escapeRegExp = function(string) {
        return string.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1");

    var searchInput = document.getElementById(formId).elements["primoQueryTemp"];
    var searchString = searchInput.value.replace(/[,]/g, " ");
    for (var specialChar in base64_encoding_map) {
        charRegExString = escapeRegExp(specialChar);
        base64Regex = new RegExp(charRegExString, "g");
        searchString = searchString.replace(base64Regex, base64_encoding_map[specialChar])
    document.getElementById(formId).elements["primoQuery"].value = "any,contains," + searchString;

<form id="searchForm0" name="searchForm0" method="get" target="_blank" action="" enctype="application/x-www-form-urlencoded; charset=utf-8" onsubmit="searchPrimo('searchForm0')">

<input type="hidden" name="vid" id="vid" value="01FALSC_PBSC:PBSC">
<input type="hidden" name="tab" id="tab" value="Everything">
<input type="hidden" name="search_scope" id="search_scope" value="MyInst_and_CI">
<input type="hidden" name="lang" id="lang" value="en">
<input type="hidden" name="pcAvailability" id="pcAvailability" value="false">
<!-- Fixed parameters -->
<input type="hidden" name="query" id="primoQuery">
<input type="text" id="primoQueryTemp" value="" size="35">
<!-- Search Button -->
<input id="go" title="Search" type="button" onclick="searchPrimo('searchForm0')" value="Search" alt="Search">


Primo VE Keyword Widget Instructions

Instructions for creating customized keyword widget.