7 Replies Latest reply on Sep 17, 2014 5:41 AM by Russell Christopher

    How to use JavaScript API to open workbook in same window?

    Peter Tram



      I am trying to leverage the JavaScript API to open a workbook in the same window. Currently, I have a workbook in which clicking on a button (a simple dashboard URL action to the URL of the other workbook on our Tableau server) causes the new workbook to open up in a new window. Rather than having it open in a new window, I would like it to open in the same window.


      My understanding is that JavaScript API provides syntax for this? I followed this answer which should be exactly what I want to accomplish, but to no avail: Set Server Views to Open Links in the Same Window | Tableau Software.


      I did end up trying the ?:embed=y&:linktarget=_self at the end of the URL in the dashboard action and that did not work. I tried adding it to the URL in the address bar of my browser window and then selecting the link, and that too did not work. Where should I put this code?


      My hunch was that I needed to have my Dashboard embedded in a webpage somewhere in order to call on the JavaScript API. I created a HTML webpage shell (not live online, just an HTML file) and embedded a link to my Dashboard. Still, when I click the button it opens in a new window.


      In the HTML I simply copied the Embed code from our Tableau Server.

      Part of the code is "javascripts/api/viz_v1.js'></script>", which seems wrong. Shouldn't it be api/tableau_v8.js?


      Any help is appreciated