Redirecting to custom scheme from web app

I have an app that has a custom scheme, lets say xxx for now.
If I embed xxx://path to a QR code, it will redirect to my app but when I try to do it from my web app in the forms below it does not work.

window.location = "xxx://path";
document.location = "xxx://path";

When using Expo Go, I was able to open the app with the same method, just by using

exp://path

instead.

Is there something I am missing?

Apparently it also works if I click on the shortcut google chrome shows since I visited that url very often.
The only problem is if I write the url manually.