简体   繁体   中英

Tableau Workbook won't appear in website when trying to embed with Javascript

So I've been able to successfully embed a workbook hosted on Tableau Server using the html embed code. I now want some more flexibility with which reports I'm displaying to certain users of the website so I'm moving to the Javascript API. Unfortunately the workbook now isn't loading.

I'm following the Basic Embed tutorial on Tableau's website: https://onlinehelp.tableau.com/current/api/js_api/en-us/JavaScriptAPI/js_api_sample_basic_embed.html

Here's my code:

function initViz() {
        var placeholderDiv = document.getElementById('tableauPlaceholder');
        var url = 'https://#########.#######.###/views/EnrollmentTool/EnrollmentChange'   
        var options = {
            hideTabs: true,
                    onFirstInteractive: function () {
                        console.log("Run this code when the viz has finished loading.");
                    }
        };
        var viz = new tableau.Viz(placeholderDiv, url, options);
    }

The onFirstInteractive log statement doesn't get called, so it seems that the viz isn't actually loading.

I discovered the issue, the API version I was importing into my HTML file was viz_v1.js.

I had to use tableau-2.min.js instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM