Created
November 12, 2015 11:38
-
-
Save kristianrl/da1f50d83ebbb384d715 to your computer and use it in GitHub Desktop.
Google search in new tab for each line in a textfield
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>New Google search for each line</title> | |
<script> | |
function searchgoogle () { | |
var searchlines = document.getElementById("searchfield").value; | |
searchlines = searchlines.split("\n"); | |
for (var i = 0; i < searchlines.length; i++) { | |
document.getElementById("output").innerHTML += i + ": <a href=\"http://www.google.com/search?q=" + searchlines[i] + "&btnI=I\">"+ searchlines[i] +"</a><br />"; | |
// SetTimeout? | |
window.open("https://www.google.com/search?q=" + searchlines[i] + "&btnI=I", i); | |
} | |
} | |
</script> | |
</head> | |
<body> | |
Paste the items you want to google in the list below, with one item per line.<br /> | |
<textarea id="searchfield" style="height: 500px; width: 450px;"></textarea><br /> | |
<button onclick="searchgoogle()">Search</button> | |
<div style="background-color: pink;" id="output"></div> | |
Note that this is <a href="http://stackoverflow.com/questions/16749907/window-open-behaviour-in-chrome-tabs-windows">not working on Google Chrome</a>. | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment