Search code examples
javascriptandroidwebviewlimit

Limit of webview content android


I am trying to load javascript files into webview. Some of that files are really big, in sum they have 344 kB. When I am trying to call some of JS function it seems, that position of that function matters. If I load js file with that function first, it works, but if I load it at last, nothing happened. Is it possible, that webview have some limit of loaded data? I have this HTML container

private static final String jsHtmlContainer = "<html><head><script type=\"text/javascript\">%s</script></head></html>";

I load all of files into one string and that string i place instead of %s in this container. This container i load into webview like this

mWebview.loadData(content, "text/html", "UTF-8");

Function that I called doesn't depend on any other function


Solution

  • Well, it shows that problem is somewhere else. By accident i discovered some question about javascript here on stackoverflow and there was comment, that in javascript function body cannot be comment starting with //. When webview read this then stop loading everything else. And in my functions was several of these comments, so after removing them calling functions work.