简体   繁体   English

Javascript代码在Chrome和Firefox上给出错误

[英]Javascript Code giving error on chrome and firefox

I have used below lines in my code for consuming web services using javascript 我在代码中使用了以下几行,以便使用javascript消费网络服务

var ns = (wsdl.documentElement.attributes["targetNamespace"] + "" == "undefined") ? wsdl.documentElement.attributes.getNamedItem("targetNamespace").nodeValue : wsdl.documentElement.attributes["targetNamespace"].value;

the above javascript code is running fine on IE and safari but on chrome and firefox it is throwing error on console: 上面的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 

Please Help 请帮忙

Thanks in Advance 提前致谢

If you run chrome with the command line 如果您使用命令行运行chrome

like 喜欢

chrome.exe --disable-web-security

This is what i use when developing 这是我在开发时使用的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM