0

I want to load my webView which url is http://pickalize.info:4000 and using a lot of javascript.

So I write code like this.

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.webview);
        WebView webView = (WebView)findViewById(R.id.webview);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setDomStorageEnabled(true);
        webView.loadUrl("http://pickalize.info:4000/");
    }

I tried change url to http://www.google.co.jp then it show the page correctly. But my site doesn't show up.

Why it doesn't show my site?

Do you have any idea? Thanks in advance.

nobinobiru
  • 792
  • 12
  • 28
  • is your site supposed to contain only `fff` in its body? – FoamyGuy Mar 10 '13 at 15:39
  • No , it's my miss. I removed it .please reload it. – nobinobiru Mar 10 '13 at 15:41
  • 2
    now there is no content in the body. it is a blank page in my PC browser, so I assume it is also a blank page in a WebView. what makes you think it is not loading? – FoamyGuy Mar 10 '13 at 15:43
  • I fixed my site . I can see my site. Can you see my site. If you can't see it, it may be client side error. – nobinobiru Mar 10 '13 at 15:50
  • Sorry @FoamyGuy , I tried to check my site at another device. And I can't my see my site. I can see my site at only local machine. I'll fix it . – nobinobiru Mar 10 '13 at 15:53
  • still blank. I am assuming the issues are with your site itself, rather than with your Android WebView code. – FoamyGuy Mar 10 '13 at 15:56
  • hmm,My app is just made of index.html/css/js files. And it hosting by python -m SimpleHTTPServer 4000 command. But it doesn't works at another machine. – nobinobiru Mar 10 '13 at 16:05
  • @FoamyGuy I fixed url to http://nnn0219.herokuapp.com . But it doesn't still load my webView. Please check it out. – nobinobiru Mar 10 '13 at 16:51
  • Possible duplicate of [Android WebView not loading URL](https://stackoverflow.com/questions/16207094/android-webview-not-loading-url) – Shadow The GPT Wizard Jun 14 '17 at 19:24

1 Answers1

0

Can you double-check in the web browser on your Android device that your web site is listening on port 4000 - it seems to be listening on port 80 (the default port for HTTP).

When I visit your web site on the default port e.g. http://pickalize.info/ then I get a web page that includes a list of URLs. Note: http://pickalize.info:80/ is equivalent to above and loads the same web page I see without the port number in the URL.

The page has the following text:

Pickalize

    Iphone Apps
    Profile
    Others
    RSS

    no valid 'aps-environment' error 2013-03-02
    ノートを買った 2013-03-02
    JavaでJSON 2013-03-01
    もしかして 2013-03-01
    半日で作ったしょぼいアプリがリリースされた 2013-02-27
    WordBench香川に行ってきた 2013-02-25
    Apple's game center problem. 2013-02-24
    observer 2013-02-21
    ナビゲーションバーを作ってみた。 2013-02-21
    My App has rejected. 2013-02-20
    プログラミングを始めて20ヶ月経って(経過) 2013-02-18
    Python のスクリプトをどこでも実行する 2013-02-17
    やっと... AppStoreに提出できた 2013-02-17
    iOS開発のために画像を編集するやつ作った. 2013-02-17
    Admobを埋め込む注意点 2013-02-16
    Flaskで自分だけのブログを作った。 2013-02-15

I get similar content in a mini Android app I just created that uses your sample code. To make sure it copes with port numbers in the URL I made the following minor change:

    webView.loadUrl("http://pickalize.info:80/");

However when I try to visit your web site using port 4000 I get a message telling me the web site is not available. I have tried from my Android device and my laptop. There doesn't appear to be a site listening / hosted on port 4000; there does seem to be a site on port 80.

Please double-check your site is being hosted on port 4000 and that you can reach it from a computer that's using the internet to connect to the site (in case there are router or firewall restrictions that block traffic to port 4000).

PS: The web page on port 80 has minimal javascript, from view source in my laptop web browser, this is what I can see

<script src="/static/js/rainbow.js"></script>
<script src="/static/js/languages/javascript.js"></script>
<script src="/static/js/languages/generic.js"></script>
<script src="/static/js/languages/python.js"></script>




<!--google analytics-->
<script type="text/javascript">

  var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-15508754-4']);
      _gaq.push(['_trackPageview']);

        (function() {
                var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
                    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
                        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
                          })();
// google feed


google.load("feeds","1");
var init = function(){
};
google.setOnLoadCallback(init);

</script>
JulianHarty
  • 3,178
  • 3
  • 32
  • 46