Microsoft EDGE使用typescript文件报告XHR HTTP404(Microsoft EDGE reports XHR HTTP404 with typescript file)
当我从Visual Studio 2015调试Typescript Web应用程序时,使用Microsoft EDGE浏览器报告以下内容;
HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR): GET - http://localhost:2543/scripts/Helpers/jsontable.ts
我的项目中有一个
jsontable.ts
文件,但它jsontable.ts
scripts
下。 我还在我的解决方案中进行了全文搜索,并且除了在_references.ts
文件中之外我还没有找到对'jsontable.ts'的其他引用。 问题仍然存在。 其他浏览器不会在F12网络窗格中报告此错误(使用Internet Explorer 11,Chrome,Opera和FireFox进行测试)。 我知道我不会在我的申请中自己从其他州发送此请求。 有没有其他人经历过这个。 有什么问题吗?When I debug a Typescript web-application from Visual Studio 2015, using the Microsoft EDGE browser it reports the following;
HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier). (XHR): GET - http://localhost:2543/scripts/Helpers/jsontable.ts
I have a
jsontable.ts
file in my project, but it is NOT located underscripts
. I have also done a full text-search in my solution, and haven't found other references to 'jsontable.ts' other than in the_references.ts
file which I have now removed. The problem is still there. Other browsers doesn't report this error in the F12 network-pane (tested with Internet Explorer 11, Chrome, Opera and FireFox). I know for sure I don't send this request myself from other states in my application. Has anyone else experienced this. Is there any fix?
原文:https://stackoverflow.com/questions/34244816
最满意答案
所以我最终放弃了Bing,并使用了GoogleMaps。 说实话,第一次尝试就像魅力一样! 使用Microsoft工具太多了......
无论如何...
首先是在index.html中加载gogle API:
<script src="http://maps.googleapis.com/maps/api/js"></script>
然后,在控制器中,在容器中添加GoogleMaps API(如果需要,还可以将引脚添加到中心:
var tmpMap = new google.maps.Map(document.getElementById('myContainer'), { center: { lat: parseFloat($scope.lat), lng: parseFloat($scope.long) }, zoom: 12, mapTypeId: google.maps.MapTypeId.ROADMAP }); var tmpMarker = new window.google.maps.Marker({ position: tmpMap.getCenter(), map: tmpMap, title: 'My Title' });
然后,设置容器的大小(与BingMaps相反,Google不会调整容器的大小..所以没有大小,你将无法看到任何东西)
最后,将CSP设置为接受来自googleapi.com/*的代码。在此示例中,Il打开了所有内容的CSP,这对真正的应用程序来说不是一件好事:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src * 'unsafe-inline'; script-src *">
瞧!
谷歌是爱,谷歌是生命:)
So I finaly gave up on Bing, and used GoogleMaps instead. And to be honest, it works like charm on the first try ! So much for using Microsoft tools...
Anyway...
First is to load the gogle API in the index.html :
<script src="http://maps.googleapis.com/maps/api/js"></script>
Then, in the controller, add the GoogleMaps API in the container (and adding a pin to the center if needed :
var tmpMap = new google.maps.Map(document.getElementById('myContainer'), { center: { lat: parseFloat($scope.lat), lng: parseFloat($scope.long) }, zoom: 12, mapTypeId: google.maps.MapTypeId.ROADMAP }); var tmpMarker = new window.google.maps.Marker({ position: tmpMap.getCenter(), map: tmpMap, title: 'My Title' });
Then, setting a size to the container (contrary to BingMaps, Google doesn't resize the container.. So without a size, you won't be able to see anything)
Finaly, set the CSP to accept code from googleapi.com/* In this sample, Il opened the CSP to everything, which is not a good thing to do on a real app :
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src * 'unsafe-inline'; script-src *">
And voilà !
Google is love, Google is life :)
相关问答
更多-
允许Web套接字的content-security-policy元标记(content-security-policy meta tag for allowing web socket)[2022-02-17]
我有一个类似的问题。 这影响Cordova 5.xx请参阅Nic Raboy的这篇博客文章https://blog.nraboy.com/2015/05/whitelist-external-resources-for-use-in-ionic-framework/ 我不得不稍微调整元标记以使我的websocket连接。 这是什么样的;您已在style-src部分添加了url,如果您尝试加载远程脚本源,则必须在script-src部分中添加源URL。Bing地图绘图工具模块(Bing Maps Drawing Tools Module)[2021-09-19]
Bing Maps V8内置了绘图工具。使用它可以替代我为V7创建的旧绘图工具模块(旧版本不像V8中的内置工具那么好)。 这里有一些资源: https://bingmapsv8samples.azurewebsites.net/#DrawingTools_Basic https://www.bing.com/api/maps/sdkrelease/mapcontrol/isdk#dtDrawThings+JS https://msdn.microsoft.com/en-US/library/mt750543 ...Bing语音和Bing地图在Windows 8商店应用中存在冲突(Bing Speech and Bing Maps conflicting in Windows 8 Store app)[2024-01-12]
我之前遇到过这种情况。 语音API可能会覆盖Microsoft名称空间。 有两种选择。 第一种是在语音参考之后添加Bing Maps脚本引用。 Bing Maps SDK扩展了Microsoft命名空间,但不会覆盖它。 第二个选项是更改Bing Maps控件的命名空间: 在引用html文件中的sdk js文件之前添加片段,如下所示: 窗口。$ MapsNamespace = 'MicrosoftJS' ; 然后用'Microsoft'替换新创建的自定义命名空间,如下所示: MicrosoftJS .Maps ...添加style="position:relative; width:400px;"后,我能够获得所需的布局 到包含地图的div 。 function LoadMap() { var map = new VEMap('pnlMap'); map.LoadMap(); } 这可以直接在您的HTML或使用的组件中(例如,您拉入到您页面的Facebook小部件添加此内容),也可以在您的浏览器使用的浏览器扩展中。 您可以通过在配置中添加unsafe-inline来允许此在线脚本,如下所示:Header set Content-Security-Policy "script-src 'unsafe-inline' 'self' https://maxc ... 让bing地图全部铺设(Make bing maps streetch all the may)[2022-05-14]
使用“*”使行和列填充容器的其余部分 也可以使用Grid.ColumnSpan =“2”,以便地图跨越两列