Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

google search results in iframe alternative

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...