TelegramMessenger / Telegram-iOS

Telegram-iOS
5.91k stars 1.57k forks source link

Links opening applications are not working o #1491

Open dza35013 opened 3 weeks ago

dza35013 commented 3 weeks ago

Checklist

Description

I am using javascript and I want to redirect the user on another system application, so here is my code: window .open( "https://redirect-url-there.com", "_parent" ) ?.focus?.(); This code is working on android version but the thing is, on IOS, it works only if I add it in onclick without any intermediate function. For example, when I call it like 1s after the button click it doesn't redirect, which is a really strange bug ? It's maybe an issue with async functions that call a redirect or something ? But it really seems that if the redirect isn't called right after the click it won't go to the system application. It doesn't do it on android version or in any other real browser. Also I think, if it's like 1s later, I see the loading bar that begin and go to like 1/4 and then it doesn't do anything or sometimes I see that it goes to the target site and then go back to the original one without any reason and without redirecting the user. Note that the apps I tried with is MetaMask.

Expected Behavior

It should redirect the user

Actual Behavior

Tell us what happens instead

Steps to Reproduce

  1. Make an html page with this code set in onclick function of any button
  2. In the same html page set also the same but that call it 1s later for example with creating an async function and include "await new Promise((resolve) => setTimeout(resolve, 1000));" at the start of the function
  3. Try both buttons and see the error

Environment

Device: iPhone

iOS version: last

App version: last

dza35013 commented 3 weeks ago

There is another condition than the 1s that I just found, if I edit page html just a bit it won't work, but if it stays the same it will work.