2015-10-07 292 views
0

我收到錯誤:「無法加載資源:服務器響應狀態爲404(未找到)」在JavaScript文件中的圖標文件。Apache Cordova:「無法加載資源:服務器響應狀態爲404(未找到)」

試圖讓一個標記顯示在谷歌地圖。

var image = { 
       url: "green.png", 
       size: new google.maps.Size(20, 32), 
       origin: new google.maps.Point(0, 0), 
       anchor: new google.maps.Point(0, 32) 
      }; 

var marker = new google.maps.Marker({ 
       position: { lat: latitude, lng: longitude }, 
       map: map, 
       icon: image, 
       title: "" 
      }); 

我正在使用Visual Studio 2015和Apache Cordova。

文件位於www/scripts/googlemap.js和www/scripts/green.png中。

編輯: 主要問題是來源。網址應該是/scripts/green.png或scripts/green.png。我以爲我曾嘗試過這些,但沒有得到那些因某種原因而工作的人。

回答

0

我沒有使用任何插件。基本的JavaScript谷歌地圖與API。

我已經回答了我的第一篇文章,但問題是來源。網址應該是/scripts/green.png或scripts/green.png。我以爲我曾嘗試過這些,但沒有得到那些因某種原因而工作的人。

有時在Visual Studio Rebuild中無法正常工作。必須先做好清理工作,然後再打造。也許這是第一次的問題。不知道。但一切正常順利!

相關問題