简体   繁体   中英

Inserting google search results into an iFrame for Mobile apps

I am trying to load the results of a google search into a div of my HTML page.

I plan to make a phonegap app whose home screen is a custom HTML page - with a text box and a search button, that loads search results from a search engine of choice.

I know there's a very similar question, but it didn't have any solutions or options. They were more like workarounds.

Are there any legit ways to do it? I tried custom search engine - it's not good as google's search results (guess its obvious).

EDIT: Forgot to mention, I started with implementing the iFrame, but got stuck with SAME ORIGIN header issues, rendering the iframe blank.

If all search requests have to be routed to my page (or program), is building a browser the only option?

As far as I know Google does not have an API for "all" websites. I also can't imagine that they have any interest in this...

I think the workaround with an iframe integration is the easiest way. You just have to do something like that:

 <iframe src="https://www.google.com/search?igu=1&q=test"></iframe> 

And replace the "test" in the src with the user search input. By the way you definitely don't have to implement an browser by yourself...

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM