Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In android's Google Chrome, how to set unsafely-treat-insecure-origin-as-secure

Tags:

I'm using getUserMedia() in my web app which works fine when I test my app on localhost. But if I treat my laptop as server and launch app in Google Chrome browser of my android phone, it gives me the error:

getUserMedia() no longer works on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://goo.gl/rStTGz for more details.

When I checked [https://goo.gl/rStTGz][1] I got to know that getUserMedia() is deprecated on insecure origins. It is written that for development mode,

You can run chrome with the --unsafely-treat-insecure-origin-as-secure="example.com" flag (replacing "example.com" with the origin you actually want to test)

How and where can I set this flag? Is there any other alternative?

like image 996
Developer Avatar asked Jan 19 '16 13:01

Developer


People also ask

How to enable insecure content in google Chrome android?

Go to about://flags , search for unsafely-treat-insecure-origin-as-secure flag, and enable it. You will have to provide the origin which you want to be treated as secure. Multiple origins can be entered as comma-separated values. Relaunch your browser after making this change.


1 Answers

This can be done from chrome://flags/ or about://flags.

Go to about://flags, search for unsafely-treat-insecure-origin-as-secure flag, and enable it. You will have to provide the origin which you want to be treated as secure.
Multiple origins can be entered as comma-separated values.
Relaunch your browser after making this change.

Note that the protocol part is also important, and specifying the IP address, or the domain name isn't enough. eg. http:// in http://192.168.43.45. If you are not using port 80, then you may have to specify that too.

The following is a screenshot from my mobile phone.

Mobile: Samsung Galaxy S10e
Android version: 10 (Android 10)
Google Chrome version: 79.0.3945.136

About flags in chrome on Android

For local testing of a website I am building, geolocation was needed. Geolocation is allowed in secure locations. I do have a production server with HTTPS certificate, but the development and the debugging process would become too slow if I have to upload content to it every time.

More info

  1. https://www.chromium.org/Home/chromium-security/prefer-secure-origins-for-powerful-new-features
like image 78
Sahil Singh Avatar answered Sep 22 '22 01:09

Sahil Singh