链接在我的HTML5应用上无法正常工作

时间:2013-03-27 21:05:21

标签: android html5 cordova hyperlink

我一直在四处走动,试图尽可能多地应用不同的解决方案,试图自己解决这个问题。事实是我不能!

我正在Adobe PhoneGap上用HTML5开发一个非常简单的应用程序。该应用程序只是用户应单击和访问相应网站的链接列表。问题?问题是网站是在应用程序上打开而不是在浏览器上打开。我已经尝试了我所知道的一切......设置目标_blank,应用this solutionthis onethis 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>

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

1 个答案:

答案 0 :(得分:1)

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

<!-- 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>