0

I can use jquery .contents() to get element of iframe e.g. the iframe #ours_iframe in the sample code

<iframe src="{{ url_for('t01_ours_iframe') }}" id="ours_iframe></iframe>

Though with iframe of google data studio, aka ggds, I cannot do so using .contents() ie trying to call .contents() will result as length=0 e.g. the iframe #ggdschart__div_in_iframe in the sample code

<iframe width="880" height="660" src="{{ ggds_chart_embedurl }}" frameborder="0" style="border:0" allowfullscreen id="ggdschart_iframe"></iframe>

The difference of the two can be seen by printing their .length - please refer to the full sample code here

console.log(`ggdschart__div_in_iframe.length : ${ggdschart__div_in_iframe.length}`) 
console.log(`ours__div_in_iframe.length      : ${ours__div_in_iframe.length}`)       //NOTE while            we CAN get .contents() here normally              ie .length = 7

My google search and search right on our stackoverflow site resulted with little helpful results. So my question is how to get ggds 's iframe elements using jquery?

oguz ismail
  • 39,105
  • 12
  • 41
  • 62
Nam G VU
  • 30,868
  • 67
  • 216
  • 353
  • 1
    I guess, it is not possible. You host your webpage somewhere and embedded a iframe from google data studio. There are different domains and it is blocked by XSS. https://stackoverflow.com/questions/6170925/get-dom-content-of-cross-domain-iframe – Samuel Apr 23 '22 at 09:20

0 Answers0