How to embed Tableau in a webpage using JavaScript JavaScript API?

I'm starting to try to embed the Tableau visualization in my webpage, so whenever a link is clicked, the visualization is displayed on the page. But the browser loads with an error on the tableauSoftware object. How can I initialize this object?

I am using a trial version of the Tableau server

<html> <head> <script type='text/javascript' src='http://localhost:85/javascripts/api/viz_v1.js'></script> <script> function initializeViz() { var placeholderDiv = document.getElementById("tableauViz"); var url2 = "http://localhost:85/views/test_page/Sheet1?:embed=y&:display_count=no"; viz = new tableauSoftware.Viz(placeholderDiv, url2); } </script> </head> <body> <a href="#" onclick="$('#tableauViz').html(''); initializeViz()">visualize</a> <div class id ="tableauViz"></div> </body> </html> 

I get this error:

Enter image description here

+7
javascript tableau
source share
1 answer

I donโ€™t have my laptop to confirm which script should be used on the local installation of the Tableau server, but try the Tableau Public script (according to the JavaScript API Tutorial ) and see if there are any changes:

 <script type="text/javascript" src="http://public.tableausoftware.com/javascripts/api/tableau_v8.js"></script> 

Now, after checking my local installation of the Tableau server, the script you need the following:

 <script type="text/javascript" src="http://localhost:85/javascripts/api/tableau_v8.js"></script> 
+5
source share

All Articles