科尔多瓦没有打开外部链接

时间:2016-10-29 10:09:59

标签: javascript android html5 cordova

我添加了插件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

1 个答案:

答案 0 :(得分:0)

尝试使用&#39; _system&#39; 属性。它有效。

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