32
Views
3
Comments
External link not opening correctly in IOS

Hello everyone!
I got a problem working with external links in my mobile app, especially with a link that makes a redirection to WhatsApp through a link like this one: "https://api.whatsapp.com/send/?phone=XXXXXXX43&text&app_absent=0"The body of an article is sent through input parameters, so an article could have or not a link in its body. At the very beginning, all links would be redirected to the InAppBrowser plugin. But it does not work with WhatsApp since it has to redirect you to a certain chat, instead, it sends you to the app store and that's not the desirable flow.

In the OnReady action I got this piece of JavaScript, which detected if the URL obtained from the article belongs to WhatsApp, but it basically just opens up a new tab inside the app view, which opens up the correct flow and I can go to the right WhatsApp chat. I do not have a link onclick action since the article is rendered in the OnReady action. 
The problem is when I try to go back to the app and it's just basically the intermediate screen with no option to go back to the app. Android does not have this problem since they have a native 'back' button, which can redirect me back to the app no problem after opening the link. (intermediate screen w/ image)
So far I've tried changing the property window.open from '_blank' to '_system' with no success. Also tried using "window.location.href" with no success as well. Does anyone have an idea or a solution to this problem?

Kind regards!





2022-12-28 12-37-38
Luis Dinis

Hi Sebastian,
Have you tried to use this WB in one reactive application instead of mobile?
Also you can set the property window.location.
Let me know if it helps you.

Luis Dinis

UserImage.jpg
Sebastian Garrido

Hi Luis! 

I use the exact same WB for a reactive application and the problem shown here does not occur on a reactive application. The behaviour in reactive web basically opens a new tab. The problem with the iOS mobile app is that the new tab is embedded in the webview of the app. Using InAppBrowser disrupts the redirection to the WhatsApp chat.


Thank you for answering!

2021-04-09 11-42-43
assif_tiger
 
MVP

Hi Sebastian,
Try to use '_system' with the 
window.open("Your_URL", "_system");

_system will force the url to be open via default browser of mobile instead inApp

https://cordova.apache.org/docs/en/3.0.0/cordova/inappbrowser/window.open.html

Good Luck


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.