Launching from custom url scheme works using xdg-open command but not in the browser in ubuntu 22.04

I have created a custom url scheme for my application in Ubuntu 20.04. Below is the desktop entry file for it. The custom url link works fine with xdg-open command and I am able to launch the associated application (using 'xdg-open tw://myapp"). However, pasting the same link in the browser does not launch the application. I have tried this on firefox and chrome.

[Desktop Entry]
Version=1.0
Type=Application
MimeType=x-scheme-handler/tw
Name=TWSampleApp
Exec=/home/vipul/Builds/TWSampleApp %F

I have observed the application launching using the same desktope entry file in Ubuntu 20.04 in firefox. Can someone help me out on what needs to be done to able to launch from browsers?