2013-10-10 106 views
0

對於非常簡單的Cordova/Dojo應用程序,我有「unknown chromium error:-6」。 Cordova 2.9.0沒有發生這種情況?有沒有人有這個問題?如果我在桌面上運行相同的index.html,控制檯會拋出此錯誤Cordova 3.0.0 with dojo toolkit 1.9在android 4.2.2上返回「unknown chromium error:-6」

Cross origin requests are only supported for HTTP. dojo.js.uncompressed.js:308 
req.getText dojo.js.uncompressed.js:308 
injectModule dojo.js.uncompressed.js:1522 
doRequire dojo.js.uncompressed.js:6703 
dojo.require dojo.js.uncompressed.js:6740 
(anonymous function) index.html:63 

Does anyone encounter this problem? 

My application looks like this 

<html> 
    <head> 
     <meta charset="utf-8" /> 
     <meta name="format-detection" content="telephone=no" /> 
     <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> 
     <link rel="stylesheet" href="js/dojo-1.9.1/dojox/mobile/themes/android/android.css" type="text/css" media="screen" title="no title" charset="utf-8"> 
     <link rel="stylesheet" type="text/css" href="css/index.css" /> 
     <script type="text/javascript" src="js/dojo-1.9.1/dojo/dojo.js.uncompressed.js" djConfig="parseOnLoad:true"> 

     <title>Hello World</title> 
    </head> 
    <body> 


     <!-- ACCIDENT TOOLKIT PAGE --> 
<div dojoType="dojox.mobile.View" id="accHelp" selected="true"> 
    <h1 dojoType="dojox.mobile.Heading">Accident</h1> 
    <div class="text">If you are in an accident, you should first move to a safe 
    location. Below are some additional actions you can take:</div> 
    <ul dojoType="dojox.mobile.RoundRectList"> 
     <li dojoType="dojox.mobile.ListItem" 
      onclick="window.location='geo:0,0?q=police';">Call the Police</li> 
     <li dojoType="dojox.mobile.ListItem" 
      onclick="window.location='geo:0,0?q=towing';">Call for a Tow Truck</li> 
     <li dojoType="dojox.mobile.ListItem" moveTo="accInfo" transition="slide" 
      onClick="itemClicked();">Exchange Driver Info</li> 
     <li dojoType="dojox.mobile.ListItem" moveTo="accInfo" transition="slide" 
      onClick="itemClicked();">Record Accident Location</li> 
     <li dojoType="dojox.mobile.ListItem" moveTo="accInfo" transition="slide" 
      onClick="itemClicked();">Take Photos of Accident</li> 
    </ul> 
</div> 
<!-- EXCHANGE DRIVER INFO PAGE --> 
<div dojoType="dojox.mobile.View" id="accInfo"> 
    <h1 dojoType="dojox.mobile.Heading" back="Accident" moveTo="accHelp" 
     onClick="console.log('Going back');">Driver</h1> 
    <h2 dojoType="dojox.mobile.RoundRectCategory">Other Driver Info</h2> 
</div> 


     <script type="text/javascript" src="cordova.js"></script> 
     <script type="text/javascript" src="js/index.js"></script> 
     <script type="text/javascript"> 
      dojo.require("dojox.mobile.parser"); 
      dojo.require("dojox.mobile"); 
     </script> 
     <script type="text/javascript"> 
      app.initialize(); 
      function itemClicked() { 
       console.log("itemClicked()"); 
      } 
     </script> 
    </body> 
</html> 

回答

0

您是否嘗試過使用全新發布的Cordova 3.1?有一點運氣,這可能會解決這個問題。

0

經過幾天的調試,我終於找到了問題,這是由於一些dojo javascript文件名以下劃線_開頭。顯然這是Android webkit中的一個已知問題,它拒絕加載任何文件名以本地文件系統中的下劃線開頭。

解決方法是使用dojo構建。

相關問題