I faced the same issue long back when I was working with my spring based project. One thing I can tell you upfront that this is not a problem with google trends and you need to solve it with a slight change in your request.
With your request headers, you need to send an additional header X-Frame-Options
and set its value to SAMEORIGIN
.
I am not giving details about this because the similar issue has already been discussed here.
Hope this helps!!!
UPDATE 1:
Do not get confused about X-Frame-Options
and the frame you are embedding. When you try to embed a frame on your web page, then the browser checks whether you are allowing SAMEORIGIN
or not. By default, it is not enabled so you get the error. But in your back-end code, if you configure is such a way that with every request, your framework adds a header as X-Frame-Options
with value as SAMEORIGIN
then the browser will allow it.
Note that SAMEORIGIN
will allow every web page on your website and it can cause security issues. So another option is that instead of sameorigin
you just set the Google Trends website with ALLOW-FROM tag.
(As per your comment you are using the Laravel framework (I have never used php), this link can be useful for you. Or you can google for "how to set x-frame-options sameorigin in laravel".