Skip to content

Commit

Permalink
Create searchbox.js
Browse files Browse the repository at this point in the history
a search script aimed at google, the target system i.e. site parameter is hard coded. This is taken from https://pagedart.com/blog/how-to-add-a-search-bar-in-html/
  • Loading branch information
dfl1955 committed Jan 20, 2023
1 parent d228d71 commit bfdfaf5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions searchbox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* a search script aimed at google, the target system i.e. site parameter is hard coded */
const f = document.getElementById('form');
const q = document.getElementById('query');
const google = 'https://www.google.com/search?q=site%3A+';
const site = 'dfl.ddns.com';

function submitted(event) {
event.preventDefault();
const url = google + site + '+' + q.value;
const win = window.open(url, '_blank');
win.focus();
}

f.addEventListener('submit', submitted);

0 comments on commit bfdfaf5

Please sign in to comment.