facebook twitter hatena line email

Google/カスタム検索

提供: 初心者エンジニアの簡易メモ
2015年10月1日 (木) 16:34時点におけるAdmin (トーク | 投稿記録)による版 (ページの作成:「==Google検索のサイト== https://cse.google.co.jp/cse/all ==urlパラメータを渡し結果のみをGoogle検索で表示する方法== 検索エンジン選択/...」)

(差分) ←前の版 | 最新版 (差分) | 次の版→ (差分)
移動: 案内検索

Google検索のサイト

https://cse.google.co.jp/cse/all

urlパラメータを渡し結果のみをGoogle検索で表示する方法

検索エンジン選択/デザイン/レイアウト/結果のみを選択/コードを取得

結果のみ表示するコードを貼る

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

こんな感じでキーワードパラメータを渡す。 http://example.com/?q=hogehoge