2013-03-27 48 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>