Enable Direct Viewing of Particular URLs

The default Find document preview uses the IDOL View component to render most files and Web pages, and uses a sandbox on the iframe to prevent javascript execution. In some cases, you might have documents with reference URLs that you want to view directly instead, such as direct video links and posts from social media websites.

In this case, you can add a regular expression to represent allowed URLs to the Find preview white list, and provide a mapping to the HTML template that you use to generate the tag.

You can also use this option to convert a normal Youtube video link to an embed link for previewing, because the normal link has options that prevent viewing in iframes.

To enable direct viewing for URLs

  1. Go to the Find home directory.
  2. Open config.json in a text editor.
  3. Find the uiCustomization section, and add or modify the previewWhitelistUrls property. This property contains a list of mappings where the property is a URL regular expression to identify the URLs to view directly, and the value is the HTML template to use to generate the tag that displays the result (typically an iframe).

    For example:

    "uiCustomization": {		
       "previewWhitelistUrls": {
          "^(https?://)?www\\.youtube(-nocookie)?\\.com/embed/.*": "<iframe class=\"preview-document-frame\" allow=\"autoplay; encrypted-media\" allowfullscreen src=\"<%-reference%>\">",
          "^(https?://)?www\\.facebook\\.com/plugins/.*" : "<iframe class=\"preview-document-frame\" allow=\"autoplay; encrypted-media\" allowfullscreen src=\"<%-reference%>\">",
          "^(https?://)?video\\.xx\\.fbcdn\\.net/.*" : "<iframe class=\"preview-document-frame\" allow=\"autoplay; encrypted-media\" allowfullscreen src=\"<%-reference%>\">",
          "^(https?:\\/\\/)?www.youtube.com\\/watch(.*?)[?&]v=([^&?]+)(.*)": "<iframe class=\"preview-document-frame\" allow=\"autoplay; encrypted-media\" allowfullscreen src=\"https://www.youtube-nocookie.com/embed/<%-match[3]%>?<%-match[2]%><%-match[4]%>\">"
       }
    }
    

    NOTE: Find adds variable values to the HTML template, based on the document. For example, it can provide:

    • match. The regular expression match.
    • reference. The document reference.
    • title. The document title.
    • fields. A list of document fields, each with an id property (from fieldsInfo in config.json), and a values array.
  4. Restart Find to apply your configuration changes.