Open Chrome App with URL

后端 未结 8 1455
情话喂你
情话喂你 2021-02-02 14:59

Is there a way to open Chrome app on Android from default Android browser? I\'m able to open the app, but it doesn\'t redirect user to correct page. This is what I tried:

<
8条回答
  •  粉色の甜心
    2021-02-02 15:21

    The best thing is to detect the user browser

    alert(navigator.userAgent);
    

    and depending on a conditional statement

    if (navigator.userAgent.indexOf('foo')) {
     // code logic
    }
    

    and based on that use BOM API to update window location

    window.location.href = 'googlechrome://navigate?url='+ link;
    

提交回复
热议问题