For security reasons, the Access-Control-Allow-Origin header is necessary to load data from a different origin (a combination of protocol, hostname, and port number) using XMLHttpRequest.
If the site (scholar.google.com) were yours, you could change the server-side code to send that header. However, it is a third-party site, so you cannot do that. Short of an alternative access method such as a JSONP API, there is only one way to get around the limitation.
You would need to set up a proxy script on your Web server, which you could write in C#, Perl, PHP, Python, Ruby, or any other programming language. From the web browser's perspective, jQuery's connection would be to your server, not to Google. From Google's perspective, the connection would be from your server, not from your web browser.
If the Web server is publicly accessible, you would have to lock the proxy script to prevent abuse (e.g. a hacker using it to attack another web site). However, speaking of abuse, there is a more immediate issue. Google might consider your queries to be in violation of their terms of service, and they could block your access at any time. There are ways to avoid being caught, although they fall outside the scope of your question.
0
Created by PleaseStand on 2020-05-03 01:06:00 +0000 UTC
Share