i want to have a google trends graph on my html website, i pasted the the script they told me to paste, but it didnt work, i cheked nearly everything i can and then checked the consle
i tried checking the links in the script, having an id for the div and then checked the code for every word. the script is this
<script type="text/javascript" src="https://ssl.gstatic.com/trends_nrtr/1845_RC03/embed_loader.js"></script>
<script type="text/javascript">
trends.embed.renderExploreWidget("TIMESERIES", {
"comparisonItem": [{
"keyword": "paper story",
"geo": "",
"time": "today 5-y"
}, {
"keyword": "folkbladet",
"geo": "",
"time": "today 5-y"
}],
"category": 0,
"property": ""
}, {
"exploreQuery": "date=today%205-y&q=paper%20story,folkbladet",
"guestPath": "https://trends.google.com:443/trends/embed/"
});
</script>
</div>
'https://trends.google.com/trends/embed/explore/TIMESERIES?req=%7B%22comparisonItem%22%3A%5B%7B%22keyword%22%3A%22paper%20story%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today%205-y%22%7D%2C%7B%22keyword%22%3A%22folkbladet%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today%205-y%22%7D%5D%2C%22category%22%3A0%2C%22property%22%3A%22%22%7D&tz=420&eq=date%3Dtoday%25205-y%26q%3Dpaper%2520story%2Cfolkbladet' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
i expected it to show the graph as it says in the div i told it to be in but it just show google trends.com refused to conect
As far as i can see, the X-Frame-Options header is not present on the source. In fact, i tested it locally and the following works perfectly fine for me:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<iframe src="https://trends.google.com/trends/embed/explore/TIMESERIES?req=%7B%22comparisonItem%22%3A%5B%7B%22keyword%22%3A%22paper%20story%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today%205-y%22%7D%2C%7B%22keyword%22%3A%22folkbladet%22%2C%22geo%22%3A%22%22%2C%22time%22%3A%22today%205-y%22%7D%5D%2C%22category%22%3A0%2C%22property%22%3A%22%22%7D&tz=420&eq=date%3Dtoday%25205-y%26q%3Dpaper%2520story%2Cfolkbladet" frameborder="0"></iframe>
</body>
</html>
Here are the response headers from the Chrome Developer Tools Network tab
alt-svc: quic=":443"; ma=2592000; v="46,44,43,39"
cache-control: no-cache, no-store, max-age=0, must-revalidate
content-encoding: gzip
content-security-policy: script-src 'report-sample' 'nonce-Z3iTTdPM4yzQkpeJVVwOTA' 'unsafe-inline' 'strict-dynamic' https: http: 'unsafe-eval';object-src 'none';base-uri 'self';report-uri /trends/cspreport
content-type: text/html; charset=utf-8
date: Mon, 17 Jun 2019 08:58:36 GMT
expires: Mon, 01 Jan 1990 00:00:00 GMT
pragma: no-cache
server: GSE
set-cookie: SIDCC=AN0-TYuHocq97hRaeDiPAQOaNkZu8Mg2tN-M_hPw41T4GAGx_vdurPoPQEFtbScvnkRLeFuYHvQ; expires=Sun, 15-Sep-2019 08:58:36 GMT; path=/; domain=.google.com; priority=high
status: 200
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
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.