Cordova + Bing地图+内容安全政策(Cordova + Bing Maps + Content Security Policy)
我正在VisualStudio 2015中开发Cordova应用程序。我正在尝试在其中一个页面中添加BingMaps模块以在地图上显示特殊位置。 因此,我在index.html中引用它:
<script type="text/javascript" src="ms-appx:///Bing.Maps.JavaScript//js/veapicore.js"></script>
在我的控制器中,我使用以下命令:
Microsoft.Maps.loadModule( 'Microsoft.Maps.Map', { callback: function () {/*my code here*/} } );
当我启动应用程序时,我有这个错误:
拒绝加载脚本'ms-appx:///Bing.Maps.JavaScript//js/veapicore.js',因为它违反了以下内容安全策略指令:“default-src'self'data:gap: https:/ /ssl.gstatic.com'unsafe-eval '“。 请注意,'script-src'未明确设置,因此'default-src'用作后备。
我的内容安全策略是Cordova插入的默认行:
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
我尝试更改(并删除)此行而没有任何结果。
如果有帮助,我正在调试Ripple中的应用程序
I'm developing a Cordova application in VisualStudio 2015. I'm trying, in one of the pages, to add a BingMaps module to display a special location on a map. Therefore, I reference this in my index.html :
<script type="text/javascript" src="ms-appx:///Bing.Maps.JavaScript//js/veapicore.js"></script>
And in my controler, I use the following command :
Microsoft.Maps.loadModule( 'Microsoft.Maps.Map', { callback: function () {/*my code here*/} } );
When I launch the application, I have this error :
Refused to load the script 'ms-appx:///Bing.Maps.JavaScript//js/veapicore.js' because it violates the following Content Security Policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
My Content-Security-Policy is the default line, inserted by Cordova :
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
I tried to change (and to remove) this line without any result.
If it helps, I'm debugging the application in Ripple
原文:https://stackoverflow.com/questions/35392565
满意答案
好吧,经过多次搜索并将我的头撞在桌子上,我已经把这个东西搞定了。 我以为我昨天有它工作,但它只适用于Windows 7而不适用于XP ..
所以,在这里:
IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, Port); UdpClient client = new UdpClient(); client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); client.Client.Bind(localEndPoint); client.JoinMulticastGroup(IPAddress); client.MulticastLoopback = true; Client.BeginReceive(MessageReceived, null);
我当然希望记录得更好,但我想这就是为什么我们得到了大笔钱。
感谢StackOverflow提供这样一个AWESOME知识库,从中提取这些东西!!
Ok, after much searching and banging my head on my desk, I've got this thing working. I thought I had it working yesterday, but it only worked on Windows 7 and not on XP..
So, here it goes:
IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, Port); UdpClient client = new UdpClient(); client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true); client.Client.Bind(localEndPoint); client.JoinMulticastGroup(IPAddress); client.MulticastLoopback = true; Client.BeginReceive(MessageReceived, null);
I sure wish this was documented a bit better, but I guess that's why we get the big bucks $$$.
Thanks StackOverflow for providing such an AWESOME knowledgebase from which to extract this stuff !!
相关问答
更多代码中的多播地址未在DDS代码中设置(Multicast address in code not getting set in DDS code)
连接后UdpClient无法接收(UdpClient can't receive after connect)
当UdpClient正在侦听不再可用的地址时,我该如何处理?(How can I handle when a UdpClient is listening on an address which is no longer available?)
UdpClient接收到127.0.0.1的数据包,但无法获取接口IP地址(UdpClient receives packets to 127.0.0.1 but fails to get them for interface IP address)
如何在asio中找到多播发送方地址?(How to find multicast sender address in asio?)
C#等待udpClient.ReceiveAsync()失败并终止程序(C# await udpClient.ReceiveAsync() fails and terminates program)
C#UdpCLient.Receive在不同的机器上没有收到任何数据(C# UdpCLient.Receive doesn't receive any data on different machine)
Udpclient轮询UDP多播地址(Udpclient polling UDP multicast address)
监听多个多播端口(Listen on multiple multicast ports)
如何正确设置我的UdpClient以在C#中侦听多播地址239.255.255.250:1900(How do I correctly set up my UdpClient to listen on the multicast address 239.255.255.250:1900 in C#)
相关文章
更多《Spring Security 3》 【第二章】 Spring Security起步(1)
《Spring Security 3》 【第二章】 Spring Security起步(3)
《Spring Security 3》 【第二章】 Spring Security起步(2)
《Spring Security 3》 【第五章】 精确的访问控制(1)
怎么用spring security?
《Spring Security 3》 【第三章】增强用户体验(5)
《Spring Security 3》 【第一章】 一个不安全应用的剖析
《Spring Security 3》 【第四章】 凭证安全存储(1)
《Spring Security 3》 【第三章】增强用户体验(3)
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!