Skip to content

Instantly share code, notes, and snippets.

@ataliba
Created March 17, 2019 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ataliba/610083ad1ea4c35309d59ee388bc4866 to your computer and use it in GitHub Desktop.
Save ataliba/610083ad1ea4c35309d59ee388bc4866 to your computer and use it in GitHub Desktop.
<script language="javascript">
function myFunction(searchboxid) {
if (window.location.hostname == "localhost") {
console.log( "Running on localhost not a proper domain so cannot search via duckduckgo.com" );
return;
}
var q = document.getElementById('searchboxid').value;
q = encodeURIComponent( q );
// var site = "rv1.tech";
var site = "{{ .Site.BaseURL }}" ;
var url = "https://duckduckgo.com?q=" + q + "+site:" + site;
console.log( url );
window.open(url, "_self");
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment