0

I want to have a simple page with a textbox and whenever a user clicks on "search" I show a google simple search result of the given search keyword (textbox) inside an iframe.

I should add that I AM NOT looking for "Custom Search Engine". I want to simply show result of google search in an iframe.

  • If I say "google.com/m?q=xxx" the output will have side bar and top textbox, etc. which I don't want
  • even If I say "m.google.com/q=xxx" there will still be a textbox on top and some other links.

any mode in google that only and only shows search result?

[**] For guys who have worked with Windows Phone 7, there is a google app that does exactly what I want. but I don't know what url that application is using to show the search result.

Any help would be appreciated.

Mo Valipour
  • 13,286
  • 12
  • 61
  • 87

1 Answers1

0

your javascript on your page containing the iframe must modify the look (think CSS) of the iframe content. When iframe completely loads. It probably IS possible to make it as simple as only search results. Use something like this (this is from my Opera's user javascript for google):

var css = ".vspib, .vspi {display:none !important;float:left !important;} h3.r {float:left !important;display:block !important;width:100% !important;} ";       // preview buttons, don't touch - very volatile in Opera
css = css + "#vspb {display:none !important;}";         // previews
css = css + " #rhs, #rhs_block, #mbEnd, #mbEnd td, #tads {display:none !important;}";               // ads
if (typeof GM_addStyle != "undefined") {
    GM_addStyle(css);
} else if (typeof PRO_addStyle != "undefined") {
    PRO_addStyle(css);
} else if (typeof addStyle != "undefined") {
    addStyle(css);
} else {
    var heads = document.getElementsByTagName("head");
    if (heads.length > 0) {
        var node = document.createElement("style");
        node.type = "text/css";
        node.appendChild(document.createTextNode(css));
        heads[0].appendChild(node); 
    }
}
Tyler
  • 349
  • 4
  • 11
  • it's not possible to run cross-site javascript in another iframe. (otherwise you could hack anybody's bank account by showing them an iframe of their bank!) – Mo Valipour Jul 24 '11 at 13:38
  • valipour >> thanks for comment but I disagree; well actually, I might agree with you on that one point with bank --------- but I have several times did change of size of parent frame on parent page from within an iframe. Are you sure that it's not possible in opposite direction -> change CSS in a frame from within the parent frame using JS? – Tyler Aug 01 '11 at 01:00
  • Here, perhpas you should check out this link: [link](http://stackoverflow.com/questions/217776/how-to-apply-css-to-iframe) There are some good replies, athough some other will tell you it's not possible. But there is one special reply that actually takes a very basic approach, in the worst case you can do that, I guess: load the content of the google page to your page using jquery [link](http://stackoverflow.com/questions/217776/how-to-apply-css-to-iframe/2361446#2361446) – Tyler Aug 01 '11 at 01:29