URL replace not work as expected

I registered a custom url scheme to open a specific app with arguments.
In my template, I have this js code:

window.location.replace('gddict://example');

Above code works, if it’s executed, my app will be opened. But if I replace example with random string as below, it won’t open anything

window.location.replace('gddict://random string');

I’ve tested with Firefox and Edge, both work.

demo: https://sendvid.com/w16wwg2l