Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid mixed/insecure content warnings when having deep links to non-http schemes for mobile apps?

Let's say I have a mobile app that listens to all "myawesomeapp" scheme links so it can open them in the app and I have a related website. Now when a page, for eg, https://myawesomeapp.com/home/ is loaded in the browser, I create an iframe dynamically and add it to the document with the src of myawesomeapp://myawesomeapp.com/home/ so that my app can try and open up that page within itself. But most modern browsers will display an insecure/mixed content warning when such a link is created from a page served over HTTPS. Is there a way around this behaviour?

like image 352
Gaurav Dadhania Avatar asked Oct 19 '22 20:10

Gaurav Dadhania


2 Answers

Browser can't guarantee that the protocol myawesomeapp is secure (like https). So as a security consideration, it MUST warn the user that insecure content is being loaded in an otherwise secure page.

You can create a service on server to redirect to another scheme. i.e. https://website.com/deeplink/appscheme/path will redirect browser to appscheme://path.

like image 185
S.D. Avatar answered Oct 22 '22 08:10

S.D.


According to this the iframe src trick doesn't work anymore.

If you want your app to automatically trigger upon landing on a web page, I found putting this that web page's <head> tag works:

<meta http-equiv="refresh" content="0; url=myprotocol:/path1" />

Where myprotocol is the "scheme" in your intent filter.

However, I am not sure if this method will also be "blocked" future versions of the browser. As the link above stated:

you should implement a user gesture to launch the app via a custom scheme, or use the “intent:” syntax

It seems to me they want intents to be triggered only by user-initiated gestures such as clicking a button, or a link. There could be security issues if a webpage can trigger intents on its own.

like image 32
aljo f Avatar answered Oct 22 '22 10:10

aljo f