Glean Web SDK enables integrating search into your website search engine. This document illustrates how to use the embedded code within your website.
<style>
.searchbox__suggestions { display: none !important; }
</style>
<script defer src="https://app.glean.com/embedded-search-latest.min.js"></script>
<script>
window.addEventListener('load', async () => {
const getSearchBox = () => document.querySelector(".header-top__search")
while(!getSearchBox()) { await new Promise(r => setTimeout(r, 300)) }
const urlsToOpenInCurentTab = ["^https:\/\/.*"]
window.EmbeddedSearch.attach(getSearchBox(),{urlsToOpenInCurentTab})
})
</script>
The "urlsToOpenInCurentTab" is declared as a constant variable using the const keyword. It's assigned an array containing a single regular expression pattern "^https:\/\/.*" which opens up the https URL in the same tab.
Note: Please refer to this document - https://dev.glean.com/meta/browser_api/index.html for further details. Feel free to file a support request here if any assistance is needed.