开发者

webview loadurl cannot load webpage from localhost web application?

I came across an interesting issue when testing android 2.2. My testing was to use webview api,

webview.loadUrl(url);

if url is from any public domain, ex, www.开发者_如何学Cgoogle.com, the web content is rendered very well. (url="http://www.google.com") if url is from local host, ex, tomcat with port 8080, the web content is rendered as well. (url="http://10.123.21.111:8080/MyWeb") but if url is from other port, ex, websphere with port 9080, the web content is not rendered. (url="http://10.123.21.111:9080/MyWeb") there is no exception thrown, and it shows blank on the emulator.

Is there any setting needed for different port? Anyone can answer this issue?

Thanks.

John


Referring to localhost from the emulated environment

If you need to refer to your host computer's localhost, such as when you want the emulator client to contact a server running on the same host, use the alias 10.0.2.2 to refer to the host computer's loopback interface. From the emulator's perspective, localhost (127.0.0.1) refers to its own loopback interface.


if I use built-in browser in Android to access http://10.123.21.111:8080/MyWeb, the web content is rendered as expected. So it is quite wield not working by using webview api.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜