So the the code for an html search bar below loads its results on the same page but how can i make it load its results in a new web tab. Is the any way target="_blank"
can work in this scenario?
html
<div class="box">
<div class="container-1">
<input type="search" id="search" placeholder="Search..." />
<div class="icon" onclick="search(document.getElementById('search').value)"><i class="fa fa-search"></i></div>
</div>
</div>
javascript
<script>
function search(query) {
if (query.slice(0, 7) == "http://") {
window.location.href = query
} else {
window.location.href = "https://www.google.com/search?q=" + query
}
}
</script>