我在代码中使用了以下行来使用javascript
来使用Web服务var ns = (wsdl.documentElement.attributes["targetNamespace"] + "" == "undefined") ? wsdl.documentElement.attributes.getNamedItem("targetNamespace").nodeValue : wsdl.documentElement.attributes["targetNamespace"].value;
上面的javascript代码在IE和Safari上运行正常,但在chrome和firefox上它在控制台上抛出错误:
XMLHttpRequest cannot load http://192.168.50.141:4323/HelloWorld.asmx?wsdl. Origin null is not allowed by Access-Control-Allow-Origin.
Uncaught TypeError: Cannot read property 'documentElement' of null
请帮助
先谢谢
答案 0 :(得分:0)
如果使用命令行运行chrome
喜欢
chrome.exe --disable-web-security
这是我在开发时使用的