4 Replies Latest reply on Sep 9, 2017 7:10 AM by Allan Marcus

    (hopefully) Simple JS question

    Allan Marcus

      Hello,

       

      I'me testing the JS API. I can get tableau public to load, but not a viz on my server.

       

      I changed a few items below to anonymize the script, but it's the essentially the same as I'm using. If I change the "var url" line to point to a tableau public viz, the viz displays. If I point to a viz on my server, nothing happens. I was under the impression the user should be asked to authenticate, then the viz is displayed. What am I doing wrong?

       

      Thanks,


      Allan

       

       

       

      <!DOCTYPE html>

      <html>

      <head>

          <title>Basic Embed</title>

          <script type="text/javascript"

           src="http://myserver.com/javascripts/api/tableau-2.min.js"></script>

          <script type="text/javascript">

              function initViz() {

                  var placeholderDiv = document.getElementById("tableauViz");

                  var url = "http://myserver.com/#/views/myWorkbook/ChartByOrg";

                  var options = {

                     hideTabs: true,

                     width: "800px",

                     height: "700px",

                     onFirstInteractive: function() {

                       // The viz is now ready and can be safely used.

                     }

                  };

                  var viz = new tableau.Viz(placeholderDiv, url, options);   

              }

          </script>

      </head>

       

      <body onload="initViz();">

          <div id="tableauViz" ></div>  

      </body>

       

      </html>