幻影JS同步AJAX请求:NETWORK_ERR:XMLHtt prequest异常101 [英] Phantom JS synchronous AJAX request : NETWORK_ERR: XMLHttpRequest Exception 101
问题描述
我想提出一个同步Ajax调用(AJAX异步设置:FALSE)。这个效果很好。
I am making a synchronous ajax call ( ajax settings async: false ). This works well.
现在我正在写的这phantomJS自动测试,我得到这个错误
Now I'm trying to write an automated test for this in phantomJS and I'm getting this error
NETWORK_ERR: XMLHttpRequest Exception 101
我检查了我的服务日志,它似乎像服务没有得到任何请求。
I checked my service logs and it seems like service is not getting any request.
推荐答案
尝试使用命令行选项禁用网络安全 - 网络安全=没有
时,运行脚本。 ( phantomjs --web安全=无yourscript.js
)
Try disabling the web security by using the command-line option --web-security=no
when running your script. (phantomjs --web-security=no yourscript.js
)
从PhantomJS引用( https://github.com/ariya/phantomjs/wiki / API-参考):
From the PhantomJS reference (https://github.com/ariya/phantomjs/wiki/API-Reference):
- 网络安全= [真|虚假]
使Web安全和禁止跨域XHR(默认为true)也接受:<$ C $。 C> [是|否]
"--web-security=[true|false]
enables web security and forbids cross-domain XHR (default is true). Also accepted: [yes|no]
这篇关于幻影JS同步AJAX请求:NETWORK_ERR:XMLHtt prequest异常101的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!