Enable Direct Viewing of Particular URLs

The default IDOL Data Admin 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.

To configure direct viewing, add allowed URLs to the IDOL Data Admin preview white list.

You can also use this option to convert a normal Youtube video link to an embed link for previewing, because the normal link returns an X-Frame-Options header that prevents viewing in iframes.

To enable direct viewing for URLs

  1. Go to the IDOL Data Admin 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 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=\"cboxIframe view-server-page\" allow=\"autoplay; encrypted-media\" allowfullscreen src=\"<%-reference%>\">",
           "^(https?://)?www\\.facebook\\.com/plugins/.*" : "<iframe class=\"cboxIframe view-server-page\" allow=\"autoplay; encrypted-media\" allowfullscreen src=\"<%-reference%>\">",
           "^(https?://)?video\\.xx\\.fbcdn\\.net/.*" : "<iframe class=\"cboxIframe view-server-page\" allow=\"autoplay; encrypted-media\" allowfullscreen src=\"<%-reference%>\">",
           "^(https?:\\/\\/)?www.youtube.com\\/watch(.*?)[?&]v=([^&?]+)(.*)": "<iframe class=\"cboxIframe view-server-page\" allow=\"autoplay; encrypted-media\" allowfullscreen src=\"https://www.youtube-nocookie.com/embed/<%-match[3]%>?<%-match[2]%><%-match[4]%>\">" 
       }
    }
    

    NOTE: IDOL Data Admin 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 IDOL Data Admin to apply your configuration changes.