Menu

Post image 1
Post image 2
1 / 2
0

Search Bar in a Firefox New Tab Extension: Which Engine, How to Handle

DEV Community·Weather Clock Dash·29 days ago
#E8AM2VvK
Reading 0:00
15s threshold

Search Bar in a Firefox New Tab Extension: Which Engine, How to Handle Adding a search bar to a new tab extension sounds simple — it's just a text input and a redirect. But there are enough details to get right that it's worth writing down. The Basic Implementation <form id= "search-form" role= "search" > <input type= "search" id= "search-input" placeholder= "Search..." autocomplete= "off" autofocus /> </form> Enter fullscreen mode Exit fullscreen mode document . getElementById ( ' search-form ' ). addEventListener ( ' submit ' , e => { e . preventDefault (); const query = document . getElementById ( ' search-input ' ). value . trim (); if ( query ) { window . location .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More