“unsafely-treat-insecure-origin-as-secure” flag is not working on Chrome

前端 未结 7 2126
天涯浪人
天涯浪人 2020-12-01 04:36

I am using geo-location for a site running locally on my machine using HTTP on Chrome. However this does not work as I am running on HTTP as opposed to HTTPS.

On th

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-01 04:59

    You must have missed some steps. Try to follow this

    1. Go to File Explorer then paste this to address bar >> C:\Program Files (x86)\Google\Chrome\Application (or just go to where you can find your chrome.exe)
    2. Right click chrome.exe > send to > Desktop (Create Shortcut)
    3. Go to your desktop then find the chrome shortcut you've created.
    4. Rename it to ChromeForTesting (this step is optional)
    5. Right click the shortcut, then Click Properties
    6. At the "Target", paste the following at the end of the link

      --user-data-dir=/tmp/foo --unsafely-treat-insecure-origin-as-secure=http://example.com

    so Target should look somewhat similar to this

    "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=/tmp/foo --unsafely-treat-insecure-origin-as-secure=http://example.com
    
    1. Click Ok..
    2. During testing close all of your opened google chrome browser. Then double click ChromeForTesting shortcut (the one you've created), when a prompt appears, just click ok..

    EDIT: If the steps above does not work for you, you might be using Chrome V63, update it to V64 above cause this flag is messed up in V63.

    P.S. If it's still not working follow these extra steps

    1. At your drive C, create a folder and name it "ChromeTempFiles".
    2. Then in your --user-data-dir= you change the value into "C:\ChromeTempFiles"
    3. Add these to your target as well

      --allow-running-insecure-content --reduce-security-for-testing

    so your target should look like this now

    "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir=C:\ChromeTempFiles --unsafely-treat-insecure-origin-as-secure=http://example.com --allow-running-insecure-content --reduce-security-for-testing
    

提交回复
热议问题