My issue involves loading a page into a webview. Typically, when I use the code
webview.loadUrl(url);
it functions as expected. The url contains a javascript code that redirects the page. Here is the javascript code:
<script type="text/javascript">
if (!document.cookie || document.cookie.indexOf('AVPDCAP=') == -1)
{ document.write('<scr'+'ipt src="http://some_link_here+Math.floor(89999999*Math.random()+10000000)+'&millis='+new Date().getTime()+'&referrer='+encodeURIComponent(document.location)+'" type="text/javascript"></scr'+'ipt>'); }
</script>
When attempting to load this javascript code into my webview using the following:
String data = javascript_code_above;
topBannerWV.loadDataWithBaseURL("", data, "text/html", "UTF-8", null);
where 'data' represents the javascript code, the page fails to load. I have also tried the following:
topBannerWV.loadDataWithBaseURL("", data, "text/javascript", "UTF-8", null);
however, this only loads the text into the webview. Can someone provide assistance with this matter?
Thank you.