简体   繁体   中英

why can't I embed a google trends chart?

here is a trends search for the world "google": https://trends.google.com/trends/explore?q=google&geo=US

i want to embed this into my jekyll website, so i paste the embed code into my markdown file:

<script type="text/javascript" src="https://ssl.gstatic.com/trends_nrtr/2213_RC01/embed_loader.js"></script>
<script type="text/javascript">
  trends.embed.renderExploreWidget("TIMESERIES", {
    "comparisonItem": [{
      "keyword": "google",
      "geo": "US",
      "time": "today 12-m"
    }],
    "category": 0,
    "property": ""
  }, {
    "exploreQuery": "q=google&geo=US&date=today 12-m",
    "guestPath": "https://trends.google.com:443/trends/embed/"
  });

</script>

but the chart does not appear. same if i copy-paste into the html of a fiddle . some old posts tell you to use an iframe, but their solutions don't render.

what am i doing wrong?

this is an xframes issue (see related post ). the embedded chart renders fine in chrome, but in safari it throws the error:

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

from what i understand this is a safari issue, and there is nothing you can do.

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