9 Replies Latest reply on Dec 7, 2017 4:57 AM by Rupam Bhardwaj

    Embedding a viz hosted on tableau online via the Javascript API

    Krishna Kumar

      Hello all,

       

      I was wondering if anyone has experience with embedded a viz hosted on Tableau online into an HTML page via the Javascript API.

       

      I have a very simple HTML page attached to this post that is adapted from the standard JS API example that loads VIZes from Tableau public.

       

      The only differences are

       

      1. I replaced the viz with one from the standard Analyze Super Store sample that comes with the tableau online account

      2. Changed the url of the viz to the one that is mentioned as the "Link" url under my Tableau viz "share" option

      3. Replaced the top script tag to load the tableau-2.js API code from 10az.online.tableau.com instead of from public.tableau.com.

       

      Before I load this HTML file, I log into tableau under the account so that I have an authenticated browser session active.

       

      However when I load this page I consistently get a ClassCastException error (on Chrome and Firefox). I have attached a screenshot below. I have tried several variations on this and all of them fail so I am not sure what I am doing wrong.

       

      What is frustrating is that the same VIZ loads fine if I use the "embed-script" code under the sharing options.  So I dont think it is an account configuration, viz or security issue.

       

      I am pretty stumped since this is possibly the simplest use case of the API I can think of and I am surprised I am having so much trouble with it.

       

      Any help that anyone can provide will be much appreciated.

       

      Regards,

      Krishna

       

       

       

      Screenshot 2016-11-09 09.25.40.png