Open naveenkash opened 4 years ago
so i'm using this method in mounted in vue and giving me cors error .
googleTrends.realTimeTrends( { geo: "US", category: "all" }, function(err, results) { if (err) { console.log(err); } else { console.log("trends", results); } } );
this is the error
Access to fetch at 'https://trends.google.com/trends/api/realtimetrends?hl=en-US&tz=-330&geo=US&cat=all&fi=0&fs=0&ri=300&rs=20&sort=0' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I am getting the same error
Figured it out, it says in the documentation that it can't be used client side.
so i'm using this method in mounted in vue and giving me cors error .
this is the error
Access to fetch at 'https://trends.google.com/trends/api/realtimetrends?hl=en-US&tz=-330&geo=US&cat=all&fi=0&fs=0&ri=300&rs=20&sort=0' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.