Hiding an element of a web page depending on the url

I am loading a form into a page via javascript and I only want to show this form when the url contains a specific expression like: /home.
The form loads for the main page and all sub pages and should only be shown for a sub page containing the above expression, while hidden for all other cases.
I am relatively new to javascript and this problem really strikes me, so any help would be welcome and greatly appreciated.

Best,
Christian

Any help to get started is welcome