Sharing local documents in co-browse

Live Assist provides the functionality to display PDF documents after prompting the user to select a file locally - it is available from both the Assist SDK and Agent SDK.  This can be achieved with a HTML file input handled by JavaScript code.  The SDKs currently offer two methods for this: shareDocument and shareContent.  It is important to understand the differences between both methods so that you can apply the most appropriate solution to your use-case.


The Web Gateway will access the URL provided, download the file, and then push it to the consumer through the consumer-to-gateway WebSocket.  The Web Gateway, being inside the enterprise network, has access to file servers that may not be accessible to the general public.  It can get and push documents to the caller that the caller cannot get for itself.

This method will cause the document to be downloaded from within the enterprise network, e.g. if you want to share documents with the consumer that are not publicly available, but are found in the enterprise's intranet.

The following is an example using the Agent SDK which creates a function to convert the PDF into data once uploaded, thus (in theory) avoiding any CORS issues:

var convertToBase64 = function() {
return new Promise(function(resolve, reject) {
// Read file
var selectedFile = document.getElementById("input-file").files;

// Check file is not empty
if (selectedFile.length > 0) {
// Select the very first file from list
var fileToLoad = selectedFile[0];

// FileReader function for reading the file
var fileReader = new FileReader();
var base64;

// Onload of file read the file content
fileReader.onload = function(fileLoadedEvent) {
base64 =;
// resolve() handler resolve(base64);

// TODO: reject() handler

// Convert data to base64



The URL will be passed directly to the consumer's client app, which will then attempt to get and display the document.  This method is recommended for files which are generally available to the public i.e., files outside the enterprise network.  As such the caller computer is able to get and display the file for itself, without involvement from the Web Gateway.

This method will cause the request for the file to come from the consumer browser - outside the enterprise network.  E.g. if you have documents that are externally available on the open web - such as sales presentations or white-papers hosted on your public facing websites.

The following is an example with the Assist SDK:

document.getElementById("input-file").addEventListener("change", function() {
// Read file
var selectedFile = this.files;

// Check file is not empty
if (selectedFile.length > 0) {
// Share the very first file from the list




Have more questions? Submit a request