2013-03-27 49 views
1

我一直在四处奔波,试图尽可能多地应用不同的解决方案,试图自己解决这个问题。事实是,我不能!链接无法在我的HTML5应用程序上正常工作

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

必须有一些我做错了,现在我不认为我有看到它是什么!它是推动我疯了...以下是代码:

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

我最欣赏的任何帮助,我可以得到...

+0

可能重复[PhoneGap的 - 在浏览器中打开链接](http://stackoverflow.com/questions/14070841/phonegap-open-link-in-browser) – robertc 2013-03-28 00:03:03

+0

非常感谢您的反馈马塞洛!我不知道你是否正确阅读我的帖子,但正如我所说,这个解决方案已经被我尝试过了,没有结果(以及其他的!!)。因此,我的问题不是我该怎么做来解决这个问题,而是因为我找不到解决方案,我做错了什么?这就是为什么我提供了我的应用程序的整个代码...我很抱歉,如果我的英语混淆并误导你。希望你或其他人有答案... – user2104321 2013-03-28 07:36:48

回答

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>