【问题标题】:Cordova does not open external link科尔多瓦没有打开外部链接
【发布时间】:2016-10-29 10:09:59
【问题描述】:

我添加了插件 cordova-plugin-inappbrowser 1.5.0 "InAppBrowser" cordova-plugin-whitelist 1.3.0 “白名单”到项目。 cordova.js 位于 /platforms/android/platform_www/cordova.js 中。 我使用的代码是下一行:

<a href="" onclick="window.open('https://www.google.com/', '_self', 'location=no');" >Google</a>

index.html 是下一个:

<!DOCTYPE html>
<html>
    <head>
        <script src="js/jquery-2.0.2.js"></script>
        <script src="js/jquery.mobile-1.4.5.min.js"></script>
        <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
        <meta name="format-detection" content="telephone=no">
        <meta name="msapplication-tap-highlight" content="no">
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
        <link rel="stylesheet" type="text/css" href="css/index.css">
        <title>KirolAPP</title>
    </head>
    <body>
        <div role="page" id="indexPage"></div>
        <div class="app">
        <div data-role="header" align="center">
        <img src="img/kirolLogo.png">   
        <br>
        </div>
        <div data-role="content" align="center">
            <form id="formInicio">

                <output style="color: #d17b12;">Nombre</output><br>
                <input type="text" id="idNombre" style="border:1;" placeholder="Usuario"><br>
                <output style="color: #d17b12;">Clave</output><br>
                <input type="password" id="idClave"  style="border:1; color: orange;" placeholder="Clave">
                <br><br>
                <div style="text-align:center;">
                    <a href="" id="botonAcceso" class="boton" onclick="" style="color: yellow;border: 1">Entrar</a>
                </div>
            </form>
        </div>
        <br>

        <div data-role="footer" align="center" >
            <div style="text-align:center;">
                    <a href="#" onclick="window.open('https://www.google.com/', '_self', 'location=no');" >Google</a>
                    <a href="registro.html" id="botonRegistro" class="botonPagina" data-transition="turn" onclick="" style="color: yellow;">Registrarse</a>
            </div>  
        </div>

    </div>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
</body>
</html>

我经常关注另一个帖子phonegap open link in browser

【问题讨论】:

    标签: javascript android html cordova


    【解决方案1】:

    尝试使用 '_system' 属性。它有效。

    <a href="#" onclick="window.open('https://www.google.com/', '_system', 'location=no');" >Google</a>
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-12
    相关资源
    最近更新 更多