loadUrl调用js函数 传它的参数的注意事项

当把html内容通过webView.loadUrl("javascript:displayHtml("htmlContent"); 的方式传递给 js去执行的时候 

一定要注意 htmlContent 中的引号一定要被转义!

转义方式 webView().loadUrl("javascript:displayHtml(\""+htmlContent.replaceAll("\"", "\\\\\\\"")+"\")");

你可能感兴趣的:(loadUrl调用js函数 传它的参数的注意事项)