android - 链接在我的 HTML5 应用程序上无法正常工作

标签 android html cordova hyperlink

我一直在兜兜转转,尝试应用尽可能多的不同解决方案,尝试自己解决这个问题。事实是我做不到!

我正在 Adob​​e PhoneGap 上用 HTML5 开发一个非常简单的应用程序。该应用程序只是用户应单击并访问相应网站的链接列表。问题?问题是网站是在应用程序而不是浏览器上打开的。我已经尝试了我所知道的一切...设置目标 _blank,已应用 this solution , this one , this onethis one .我也一直在谷歌搜索,但结果完全一样:我的问题没有解决方案。

一定是我哪里做错了,现在我觉得我没有辨别力,看不出到底是什么!这让我发疯......这是代码:

    <!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />

        <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
        Remove this if you use the .htaccess -->

        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

        <title>Northern Landscape APP</title>
        <meta name="description" content="Northern Landscape APP - With this APP you can keep up with the latest news of our group: Features, Group Messages, new magazine issues and more!" />
        <meta name="author" content="LFS" />

        <meta name="viewport" content="width=device-width; initial-scale=1.0" />

        <!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->

        <link rel="shortcut icon" href="/favicon.ico" />
        <link rel="apple-touch-icon" href="/apple-touch-icon.png" />

        <link rel="stylesheet" href="style.css">

        <script type="text/javascript">
  $('.link').live('tap', function() {
    url = $(this).attr("rel");   
    loadURL(url);
});

function loadURL(url){
    navigator.app.loadUrl(url, { openExternal:true });
    return false;
} 
        </script>

    </head>

    <body>
        <div id="contentor">

            <header>

            </header>

            <nav>

            <div id="cabeca">
              <img src="imgs/cabecalho.png"> 
            </div>

            <br>
            <br>
            <br>
            <div id="botoeswraper">

              <div id="linha1">

                <div id="b1">
                  <div id="icone"><img src="imgs/logo_compus.png"></div>
                  <div id="texto">
                  <a href="#" class='link' rel='http://www.northernlandscape.org'>Official Website</a> </div>
                </div>

              </div>

              <div id="linha2">

                <div id="b2">
                  <div id="icone"><img src="imgs/rblogo.png"></div>
                  <div id="texto">
                  <a href="#" class='link' rel='http://www.redbubble.com/groups/northern-landscape'>Redbubble group</a> </div>
                </div>

              </div>

              <div id="linha3">

                <div id="b3">
                  <div id="icone"><img src="imgs/groupmsg.png"></div>
                  <div id="texto">
                  <a href="#" class='link' rel='http://www.redbubble.com/groups/northern-landscape/forums/7330'>Group messages</a> </div>
                </div>

               </div>

               <div id="linha4">

                 <div id="b4">
                  <div id="icone"><img src="imgs/issues.png"></div>
                  <div id="texto">
                   <a href="#" class='link' rel='http://www.northernlandscape.org/alli.php'>All NL magazine issues</a> </div>
                 </div>

               </div>

               <div id="linha5">

                 <div id="b5">
                   <div id="icone"><img src="imgs/tweeter.png"></div>
                   <div id="texto">
                   <a href="#" class='link' rel='https://twitter.com/NL_host'>Check us on Tweeter</a> </div>
                 </div>

              </div>

              </div>

            </nav>

<p>&nbsp;</p>
<p>&nbsp;</p>

            <footer>
                <p>
                    NL APP version 1.0 - Developed by LFS&copy; 
                </p>
            </footer>
        </div>
    </body>
</html>

非常感谢我能得到的任何帮助...

最佳答案

我已完成以下更改,每一项都适合我。

<!-- Opens in new tab -->
<a href="http://www.northernlandscape.org" target="_blank">Official Website</a>

<!-- Opens in new window -->
<a href="#" onClick="window.open('http://www.redbubble.com/groups/northern-landscape', '_system', 'location=yes');">Redbubble group</a>

关于android - 链接在我的 HTML5 应用程序上无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15669462/

相关文章:

android - 丢失了我的数据...能够以某种方式从我的 APK 获取我的应用程序源吗?

android - 哪些参数被传递到 AsyncTask<arg1, arg2, arg3>?

android - 机器人间隙 : how get webpage?

javascript - 如何使用 Angular Material 设计完全扩展下拉列表?

ios - 在您的证书错误上找不到 iPhone 开发者/分发身份

android - 低内存情况下的 startActivityForResult()

android - 在中国使用 Google Maps Android API

html - 未指定的内容高度,自动溢出和页眉/页脚始终在 View 中,页面上没有滚轮

html - 条形码不出现在打印预览中,但出现在 HTML 页面上

javascript - 如何在 Phonegap/Cordova 应用程序中禁用键盘?