问题
We have own form in our webpage. We want to show google(www.google.com/scholar
) results into our webpage. We tried
jQuery, Ajax
HTML framing (iFrame, frameset)
and all of these have
SAMEORIGIN
issues.
We also tried using a new tab
and found it has same problem here . All these solutions seem to work only with http://www.google.com/custom and no other google websites.
Is there any alternative to do so?
回答1:
Google prevents you from doing this. You could set up some server side code to scrape the results but this would almost definitely be blocked by Google. If this suits your needs you can create a form that submits your search to that page and opens it in a new tab like so:
<form action="http://scholar.google.co.uk/scholar" method="get" target="_blank">
<input type="text" name="q">
<input type="submit" value="Search">
</form>
Live example here: http://jsfiddle.net/v8qG8/
Update:
I mentioned that Google would block the scraping of its services, however I just found the third party library which does that. Not sure on Google's opinion on it though. http://www.icir.org/christian/scholar.html
回答2:
I answer it myself. There are no solutions so far.
回答3:
You may also want to look at Google's custom API. You can get 100 free searches a day and then you pay $5 / 1000 search after that. If you cache the results or do low volume this may work for you.
- Search API: https://developers.google.com/custom-search/json-api/v1/overview
- All Google API's: https://developers.google.com/apis-explorer/#p/
来源:https://stackoverflow.com/questions/22896796/how-to-get-google-results-into-our-webpage-without-same-origin-policy