JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Search API Sample</title>
<!-- Google Search是從「Google Web Search API Developer's Guide( https://developers.google.com/web-search/docs/ )」範例改寫而成的 -->
<!-- 首先Load Google Web Search API -->
<script src="https://www.google.com/jsapi" type="text/javascript"></script>
<script language="Javascript" type="text/javascript">
// Load Google Search Module
google.load('search', '1');
function OnLoad() {
// Create a search control
var searchControl = new google.search.SearchControl();
// site restricted web search
var siteSearch = new google.search.WebSearch();
siteSearch.setSiteRestriction("www.appledaily.com.tw/appledaily/article/supplement/");
searchControl.addSearcher(siteSearch);
// tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("searchframe"));
// execute an inital search
searchControl.execute("武陵農場");
}
// To register the specified handler function to be called once the document loads
google.setOnLoadCallback(OnLoad);
</script>
</head>
<body>
<div id="searchframe">Loading</div>
</body>
</html>