Firefox for Android: Fails to open native YouTube app on JavaScript redirect (window.location.href)
Hi everyone,
I'm currently migrating my Android automation setup (using uiautomator2) from Chrome to Firefox because Chrome frequently drops the accessibility tree. However, I've run into a specific issue regarding how Firefox handles external app intents via JavaScript redirects.
Scenario: A webpage opens a new tab and executes the following script to redirect the user: window.location.href = "https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cad=rja&url=https://www.youtube.com/watch?v=ZLh5orBSaS4";
Expected Behavior (What Chrome does): Chrome detects the YouTube link, automatically triggers the intent to open the native YouTube Android app, and closes that redirect tab.
Actual Behavior (What Firefox does): Firefox simply navigates to m.youtube.com within the browser tab and does not open the native YouTube app.
Additional Context:
I have the "Open links in apps" setting enabled in Firefox settings, but it doesn't seem to trigger for this specific window.location.href redirect.
Because I rely on uiautomator2 for my workflow, having Firefox trap the link inside the browser instead of handing it off to the YouTube app breaks the automation chain.
Is there a known workaround, or perhaps a specific flag in about:config (I can use Firefox Beta/Nightly if needed) to force Firefox Android to respect the deep link/intent and open the native app for this type of redirect?
Any insights or suggestions would be greatly appreciated. Thank you!