Hello,
Unfortunately, there is no way to prevent iOS from stopping JavaScript execution when the browser is set to the background. This behavior is a security feature implemented by iOS to protect user privacy and battery life.
When an app is sent to the background, iOS will pause all processes and background tasks to conserve battery and processing power. As a result, any JavaScript execution within a browser tab will be paused, which could lead to issues like the one you're experiencing.
One solution to this issue is to use a native mobile app instead of a web app. Native apps can use features like background processing to continue running tasks even when the app is not in the foreground.
If using a web app is a requirement, you may need to redesign your app to work within the limitations of iOS background execution. For example, you could save the authentication code to local storage and resume the authentication process when the user returns to the app. You could also use push notifications or other background features to update the user when the authentication process is complete.
Overall, it's important to design your app with the limitations of the platform in mind to ensure a seamless user experience.
Regards,
Serhiy