URL with parameter in WebView not working in Android?

前端 未结 8 1446
南笙
南笙 2020-12-20 14:40

I am trying to call the loadUrl method in a webview with the below url

http://stage.realtylog.net/iPhone/functions.php?username=xxx&ID=xxx&act=readFileAndPri

8条回答
  •  [愿得一人]
    2020-12-20 15:26

    change your url to:

    webView.loadUrl(MessageFormat.format("{0}{1}{2}","http://stage.realtylog.net/iPhone/functions.php",URLEncoder.encode("?username=xxxx"),URLEncoder.encode("&ID=xxxx"),URLEncoder.encode("&act=readFileAndPrint")));
    

    js file like this:

    data= JSON.parse(decodeURIComponent(data));
    

提交回复
热议问题