【发布时间】:2015-06-02 12:20:50
【问题描述】:
我已经成功使用 SMF.Net.WebClient 访问了一个网站。现在它在请求某个链接时有奇怪的行为:
var wc = new SMF.Net.WebClient({
URL : "http://www.invitro.ru/analizes/for-doctors/156/6671/?region_code=§ion_id=156&element_id=6671",
httpMethod : "GET",
requestHeaders : ["Content-Type: text/html"],
// When results are ready
onSyndicationSuccess : function (e) {
Pages.Webview.WV_Main.URL = this.responseText;
Pages.Webview.show();
},
timeoutInterval : 15
});
wc.run(true);
在这种情况下,onSyndicationSuccess responseText 始终为空,尽管 this.status = 200。
我什至用 Excel VBA 中的相同参数和 URL 尝试了 XmlHttpRequest。效果很好!
这里可能有什么问题?
【问题讨论】:
-
使用 WebClient 获取 html 响应似乎有问题。为什么您使用 webCLient 来显示带有 WebView 的 HTML。 WebClient 一般用于获取 JSON Restful 服务。您可以直接将 URL 提供给 WebView。
-
处于测试模式。我需要在代码中解析 html-response 以从页面中获取一些数据。是否有更合适的方法来实现我的目标?
-
我建议你使用runJS方法来达到那种目的smartface.io/developer/guides/controls/webview/…
-
谢谢!很好的建议!
标签: xmlhttprequest smartface.io