Can an input bar with corvid code be added to the header to work on all pages?

Hi guys, hope you are all safe. I was looking for some advice on working with the header section of my site using a search function I made using this video:

I have the search working on my homepage which directs to a search results page, but thought it would be ideal to have it in the header so that it shows on all of my 500+ site pages. I’m not bothered about showing results in a repeater on every page. I just want it so that if someone searches in the input bar at the top of the site it takes them to my search results page. I have seen you can add code to the Head section of your site but it’s not the same as the corvid panel so don’t know if it’s possible.

If not I’ll just have to manually add the search to all my pages which will take ages.

Hi there …

Short answer, Yes. You can add almost anything to the header.

That’s great news!

So I dragged and dropped the search bar into the Header. I then created a new “custom code” for the header section and then copied and pasted the below code from the homepage but nothing happens after searching. I think it’s the click event and keypress events…

import {local} from ‘wix-storage’ ;

import wixLocation from ‘wix-location’ ;

$w.onReady( function () {


export function searchButton_click_1() {

let word = $w( “#searchBar” ).value;

local.setItem( "searchWord" , word);`/ **new** -search`); 


export function searchBar_keyPress_1(event) {
if (event.key === “Enter” ) {

let word = $w( “#searchBar” ).value;

local.setItem( "searchWord" , word);`/ **new** -search`);  


@payment You need to put the code in the masterPage.js file, and make sure the events are active in the properties panel.

1 Like

Thanks @ahmadnasriya I got it to work. It’s a bit slow and for some reason only works once. I will have a play with it and see how things go.

Let me know how it goes.