Tableau JavaScript API without Embedding
August 29, 2016
, , , , , , , ,

Using D3.js or Chart.js without EmbeddingOne of the biggest myths of Tableau Javascript API is that you cannot use it inside Tableau Server. Some says that you need to embed your workbooks into external sites to leverage Javascript API. Well, don’t believe them since Tableau JS API works flawlessly in Tableau Server Vizportal with any workbook without any with some minor hacks.

Do you need D3.js in your workbook that interacts with the other sheets in the workbook? No issues. Want to re-define some part of the portal like what should happen when users want to export or see underlying data? It’s easy. Add excel export directly to the exporting options? It’s an hour of work. But how?

The Magic

This workbook contains a regular view and a ChartJS scatterplot view. When you click on any bars the scatterplot updates to show its underlying data using JS getData().

Tableau JS in VizPortal - Without Embedding

Tableau JS in VizPortal – Without Embedding

The magic is that we use an HTML object in our workbook that links to an HTML page published as web data connector. Web Data Connectors hosted on the Tableau Server, thus, they have the same domain as the portal and can access contents in their parent windows. If you refer parent.parent.tableau.VizManager.getVizs()[0]  then you get instantly an already initialised Tableau JS viz object. Sounds easy and actually it is.

How to try it out?

To test it locally you need administrator privileges on a Tableau Server. This is obviously required due to the security: this HTML page can read literally everything on your sessions if embedded. (Please also check if I include some nastiness, you know, audit, audit, audit). And now the steps:

  1. Download this HTML file and upload to your server
  2. Call tabadmin import_webdataconnector <html_file> on your server. Note the URL of the file on the server.
  3. Download this workbook
  4. Change the URL of Published HTML file parameter to the URL returned in step 2.
  5. Publish the workbook
  6. Open it, enjoy.

Behind the scenes

The source code is written in CoffeeScript because writing plain JavaScript is a slow and error-prone process. All of the source codes can be find in this github repo: .

We use GULP as the build tool to compile the coffeescript code down to JavaScript.


Running the development server

The development model is fairly simple:

Start your local development server:

gulp watch serve 

This tells GULP to watch for any changes on our coffeescript files, and recompile them upon change; and also start a web server that serves these compiled javascript files.

Embed into tableau

That web data connector can point to which is your local development machine, so you can see any changes you make to the javascript source code.


Ask, if you have any.

Tamás Földi

Tamás Földi

Director of IT Development at Starschema
Decades of experience with data processing and state of the art programming. From nuclear bomb explosion simulation to distributed file systems. ethical hacking, real time stream processing practically I always had a great fun with those geeky ones and zeros.
Tamás Földi
  • roshan

    it didnt work. 🙁

    • it should, could you post your error messages from the Chrome development tool’s console?

      • roshan

        My Bad! It works when i use the server with the ‘servername’.
        It is not working when its ‘Localhost’. I was trying whole the time till I posted the comment with Localhost.

      • roshan

        Great work! Thank you very much.

  • Shyju

    Does the same steps apply for 9.3 also ?

    • I just replied to your corporate email address 10 mins ago..:) It definitely works, but instead of getdata we need to call a vizql web command if we need the underlying data as well

  • Andrée Roos

    This is great work Tamás and will open up lots of possiblities when it comes to dashboard creation.

  • Andrée Roos

    I tried the example above, but couldn’t get it to work. I got the error message:

    Error: Permission denied to access property “tableau”

    Any ideas on what might be causing this?

    • it seems that the frame inside your dashboard does not have the same hostname as your tableau server. can you double check? like the host names must be equal

  • JG Hi Tamas – I imported the html file as a web data connector and published the workbook to my local server. It shows the text from the WDC so it looks like it imported correctly (“Please select a row from the left…”) but I am not seeing any JS chart show up when I make selections. Any ideas? Thanks!

  • Venkatesh

    Hi Tamas, great article. I am just about to start trying this. I have written few JavaScripts using Tableau API now in an Embedded model but I want to do that on the workbooks / views directly.
    Do you reckon that could be done? That is, without calling HTMLs. Or second option, if I create an HTML which mostly holds javascript and some PHP code, I was wondering if that could be used as web connector.
    Regards, Venkatesh

  • Gaurav Jindal

    Hi Tamas
    Amazing stuff !!! The sample worked perfectly fine on my server setup. I was watching your another video on youtube where you showed REST API for Tableau Desktop (without using Tableau Server). I am really looking foward to that as in our use-case we want to share Tableau workbooks with end-users without publishing them to server. Could you please provide more details on that approach?

  • Jackeline Russell

    The Information which you provided is very much useful for JavaScript Learners. Thank You for Sharing Valuable Information.

  • Bryant

    Hi Tamas,
    We tried this recently and found that you might need to put a bit of a delay in on recent Tableau Server versions. I wrote up the interval code for the test on the page where I cross-link this article originally —

  • rkp

    it does not work for me, I need help, I downloaded the html file and that is not the same name you use here.

  • Really this is good post. Initially I faced a trouble after downloading the html, and later on it worked for me.
    Siva prasad

  • mufeed M

    Hi Tamas,
    when I tried to use your demo, I got this

    could you help me?

    • The new version on github fixes this issue

Related items

/ You may check this items as well

Scaling Tableau Image

Scaling out Tableau Extracts – Building a distributed, multi-node MPP Hyper Cluster

One of the biggest myths of Tableau Javascript API...

Read more
Pasted image at 2018_01_09 04_59 PM

Python Experiments in Tableau 1. – Add live currency conversion to Tableau Dashboards using TabPy

One of the biggest myths of Tableau Javascript API...

Read more
Tableau Docker

HOWTO: Tableau Server Linux in Docker Container

One of the biggest myths of Tableau Javascript API...

Read more