2 Replies Latest reply on Feb 2, 2018 12:51 AM by Michael Kovner

    Tableau javascript api iFrame zoom



      I have a website in which I embed tableau workbooks.

      I'm trying to adjust the website view for smaller screens by applying zoom attribute on my html page (zoom : 80%)


      Generally it does what I expect with all the page components except the tableau iFrame.

      when I apply the zoom - instead of zooming out the iFrame, it reduces the width & height and a scroller is added.


      When I add the zoom attr to the iFrame's body style, it works perfect (see picture below)

      So I wrote a javascript function that does it:


                function apply_iframe_zoom()


                   var _iframe = document.getElementsByTagName("iframe")[0];

                   var x = _iframe;

                   var y = (x.contentWindow || x.contentDocument);


                   y.body.style.zoom = "80%";



      But I get the following error, which means that it's not possible to access an <iframe> with Javascript if the iframe is from a different domain (javascript - SecurityError: Blocked a frame with origin from accessing a cross-origin frame - Stack Overflow )

      Anyone have an idea how can I solve this?