admin管理员组

文章数量:1292300

I'm not sure what I'm doing wrong but the Google Custom Search I'm setting up on this site I have is not working the way I need it to. What I want is for the results to display within a page, and while the search takes me to the page, the results appear in a popup window for some reason.

This is what I have:

    <script>
        (function () {
            var cx = '[hidden]';
            var gcse = document.createElement('script');
            gcse.type = 'text/javascript';
            gcse.async = true;
            gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
                '//www.google/cse/cse.js?cx=' + cx;
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(gcse, s);
        })();
    </script>

<gcse:searchbox-only linktarget="_self" resultsUrl="/HomePage/Search-Results"></gcse:searchbox-only>

I tried using _parent for linktarget, but that did not solve the issue, either. Is there a way to disable this Google Custom Search from opening results in pop-ups?

I'm not sure what I'm doing wrong but the Google Custom Search I'm setting up on this site I have is not working the way I need it to. What I want is for the results to display within a page, and while the search takes me to the page, the results appear in a popup window for some reason.

This is what I have:

    <script>
        (function () {
            var cx = '[hidden]';
            var gcse = document.createElement('script');
            gcse.type = 'text/javascript';
            gcse.async = true;
            gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
                '//www.google./cse/cse.js?cx=' + cx;
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(gcse, s);
        })();
    </script>

<gcse:searchbox-only linktarget="_self" resultsUrl="/HomePage/Search-Results"></gcse:searchbox-only>

I tried using _parent for linktarget, but that did not solve the issue, either. Is there a way to disable this Google Custom Search from opening results in pop-ups?

Share Improve this question edited Apr 24, 2015 at 14:08 Dejsa Cocan asked Apr 17, 2015 at 14:26 Dejsa CocanDejsa Cocan 1,5693 gold badges20 silver badges59 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 8

Go to Google Custom Search Control panel. Select the Search-engine where you generated the Key & Code. Go to Look and Feel, from the sidebar. Change the Layout from 'Overlay'(Popup) to the desire style you need.

You can follow the image to do this -

Click on Look and Feel on the left hand side then choose whatever layout you need. After that click on Save & Get Code

Try changing the linktarget from _self to _parent.

<gcse:searchbox-only linktarget="_parent"

本文标签: javascriptGoogle Custom Search results opening in popup on pageStack Overflow