Visual Studio,Ripple Emulator和CORS / Cross Domain Ajax [英] Visual Studio, Ripple Emulator and CORS/Cross Domain Ajax

查看:414
本文介绍了Visual Studio,Ripple Emulator和CORS / Cross Domain Ajax的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用多设备混合应用程序时遇到了Visual Studio的问题。当我尝试对外部webservice的ajax调用,并得到一些错误波纹。 (跨域安全问题)。我的代码在部署到移动设备时工作正常。

I have an issue with Visual Studio when working on a multi device hybrid app. When I try do to an ajax call to an external webservice, and get some errors in ripple. (Cross Domain Security issues). My code works fine when deploying to a mobile device.

从研究中我发现了以下内容:


  • Ripple有自己的代理设置

  • Ripple has its own proxy settings


  • 在Ripple中,并在代理设置上选择本地,已禁用或远程(根据您的情况)。

  • 这似乎适用于某些人,但我现在有一个不同的错误。 (错误请求)

我发现更多信息,Chrome可以在没有网络安全模式

I found more info that Chrome can be started in no web security mode, by means of a command line switch when you run it.


  • 这个问题是,Visual Studio似乎有硬编码的Chrome路径,它



  • 因此无法在没有网络安全模式下启动chrome ...
  • / ul>
  • The issue with this, is that Visual Studio seems to have hard coded the path to Chrome, that it uses to open ripple.
  • I therefore cant start chrome in no web security mode...

推荐答案

我有与路易斯完全相同的问题,但从Chrome 48所有的CORS扩展似乎已停止工作。

I had exactly the same problem as Louis, but since Chrome 48 all the CORS extensions seem to have stopped working. I've come up with an alternative solution which I thought I'd share.


  1. 在您的Chrome安装目录中 - 可能是C:\程序文件(x86)\Google\Chrome\Application - 创建chrome.exe的快捷方式

  2. 右键单击此快捷方式,然后选择属性

  3. 在快捷方式选项卡上的目标字段中,附加以下两个字段--allow-file-access-from-files --disable-web-security
    4。保存并将快捷方式重命名为Google Chrome - 用Ripple调试

  4. 右键点击它并选择固定到开始菜单

  1. In your Chrome installation directory - probably C:\Program Files (x86)\Google\Chrome\Application - create a shortcut to the chrome.exe
  2. Right click on this shortcut and select Properties
  3. On the Shortcut tab, in the Target field append the following two fields --allow-file-access-from-files --disable-web-security 4 . Save this and rename the shortcut to "Google Chrome - Debug with Ripple"
  4. Right click on it and select Pin to Start Menu

此快捷方式将允许您运行没有网络安全的Chrome,这允许CORB在Ripple。通过使用快捷方式,这不会干扰您正常使用Chrome。现在为了使用Ripple

This shortcut will allow you to run Chrome with no web security, which allows CORS in Ripple. By using a shortcut this will not interfere with your normal use of Chrome. Now in order to use Ripple


  1. 在Visual Studio调试您的应用程序将启动Ripple在自己的Chrome实例

  2. 现在打开开始菜单,然后点击固定的Google Chrome - 使用Ripple调试快捷方式

  3. 第二个Chrome浏览器启动时会显示您正在使用

  4. 将Ripple代理URL从Visual Studio实例复制到这个新的实例,例如< a href =http:// localhost:4400 / index.html?enableripple = cordova-3.0.0-NexusS> http:// localhost:4400 / index.html?enableripple = cordova-3.0.0-NexusS <

  1. In Visual Studio debug your app which will start Ripple in its own Chrome instance
  2. Now open the start menu and click on the pinned "Google Chrome - Debug with Ripple" shortcut
  3. A second instance of Chrome will launch with a warning of "You are using an unsupported command-line flag: -- disable-web-security. Stability and security will suffer."
  4. Copy the Ripple proxy URL from the Visual Studio instance to this new one, for example http://localhost:4400/index.html?enableripple=cordova-3.0.0-NexusS
  5. Your CORS requests will now work in Ripple.

请注意,Visual Studio现在可以在Ripple中使用刚刚被用来启动Ripple。

Note that Visual Studio has just been used to launch Ripple. Debugging will need to take place using Chrome's Developer Tools.

请注意,您可以通过浏览到以下网址来仔细检查Chrome是否正在使用您的快捷方式标记:chrome:// version /

Note also that you can double check that Chrome is using your shortcut flags by browsing to the url chrome://version/

希望这有助于!

这篇关于Visual Studio,Ripple Emulator和CORS / Cross Domain Ajax的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆