Apache Cordova:“无法加载资源:服务器以404(未找到)状态进行了响应". [英] Apache Cordova: "Failed to load resource: the server responded with a status of 404 (Not Found)"
问题描述
我收到错误消息:无法加载资源:服务器响应状态为404(未找到)",并且在javascript文件中带有图标文件.
I am getting error: "Failed to load resource: the server responded with a status of 404 (Not Found)" with icon file in javascript file.
试图使标记显示在Google地图中.
Trying to get a marker to show in google map.
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一起使用.
I am using Visual Studio 2015 with Apache Cordova.
文件位于www/scripts/googlemap.js和www/scripts/green.png.
Files are located in www/scripts/googlemap.js and www/scripts/green.png.
主要问题是来源.网址应为/scripts/green.png或scripts/green.png.我以为我以前尝试过这些,但是由于某种原因并没有使它们起作用.
Main problem was source. Url should be /scripts/green.png or scripts/green.png. I thought I tried these before but didn´t to get those working for some reason.
推荐答案
我没有使用任何插件.具有API的基本javascript google maps.
I am not using any plugin. Basic javascript google maps with API.
我已经回答了我的第一篇文章,但问题出在源头.网址应为/scripts/green.png或scripts/green.png.我以为我以前尝试过这些,但是由于某种原因并没有使它们起作用.
I already answered into my first post but the problem was source. Url should be /scripts/green.png or scripts/green.png. I thought I tried these before but didn´t to get those working for some reason.
有时在Visual Studio重建中将无法工作.必须先清洁,然后再构建.也许这是第一次出现问题.不知道.但是现在一切都顺利了!
Sometimes in Visual Studio Rebuild won´t work. Have to do first clean and than build. Maybe that was the problem for the first time. Dunno. But everything works now smoothly!
这篇关于Apache Cordova:“无法加载资源:服务器以404(未找到)状态进行了响应".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!