google search results in iframe alternative

浪尽此生 提交于 2019-11-28 03:35:14

问题


I don't think it's possible from what I've read, but wanted to see if anyone else was in a similar situation and found a more elegent solution to this problem.

Basically I have a site I am building, nothing fancy, which consists of a header section, and then one big iframe to display the content of the page in. I know, I know, iframe are generally looked upon with displeasure, but for my needs, it works wonders.

My issue, is that in the header of the page, I have a simple google search box (basically just an html form), and have set the target as my iframe. Obviously when searching for anything, the results should show up in the iframe, however, all i get is a message saying this content can't be displayed in an iframe. This makes sense and im sure it is of googles design not to allow this kind of practice.

For me, this would be the most ideal situation, and was wondering if anyone knew of a way to display the search results within my iframe?

I have also looked at possibly displaying a lightbox, or similar popup box, with an ajax request to display the google page, but have thusfar been unsuccessful.


回答1:


You won't be able to use any kind of frame anymore as Google obviously put an end to that by blocking frames altogether. Your only solution is to use the custom search API and then parse and display the results yourself.



来源:https://stackoverflow.com/questions/7966476/google-search-results-in-iframe-alternative

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!