Lalitha03
Lalitha03

Reputation: 101

Getting error while trying to render a view from tableau server using javascript

I'm getting the below error while trying to run the javascript code in attempt to render a view from my tableau server which has trusted authentication.

While trying to run the JS code, the view is not getting rendered in the browser, however, if I log in to my tableau server on one tab and run the JS in another tab, the view is getting rendered as its taking the authentication from the browser cache.

Error says:

Refused to display < url> in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

Code:

<script type="text/javascript" 
    src="http://<tableau server URL of the view>"></script>
<script type="text/javascript">
    function initViz() {
        var containerDiv = document.getElementById("vizContainer"),
            url = "<Tableau server URL of the view>",
            options = {
                hideTabs: true,
                onFirstInteractive: function () {
                    console.log("Run this code when the viz has finished loading.");
                }
            };
        var viz = new tableau.Viz(containerDiv , url);
        }

Request help.

Upvotes: 0

Views: 2403

Answers (4)

peace101
peace101

Reputation: 1

You have to go to browser settings and allow third-party cookies. Tableau explicitly says that in the documentation.

Upvotes: 0

Anton Karatkevich
Anton Karatkevich

Reputation: 31

Try to add ?:embed=yes to the link end.

Upvotes: 2

Saurav Dubey
Saurav Dubey

Reputation: 39

I had the same issue and I fixed it without disabling clickjacking.!

Here is what i did:

If you do not want to disable Clickjacking then,

instead of using the browser url of your tableau view,

use the link (yes! i am talking about a URL not the embed code) provided by tableau server in the SHARE button in your view.

Hope this Helps!

Upvotes: 1

Lalitha03
Lalitha03

Reputation: 101

It's resolved. Had to do some changes in the tableau server configuration. Disabled clickjacking and it worked.

Thanks everyone, esp @anoop :)

Cheers!

Upvotes: 1

Related Questions