I try to upload content from a "playbuzz" script within WebView
, I found a way to do it, which is loading the script in a web page:
String urlPlayBuzz = "http://www.jorgesys.com/playbuzzcontent.html";
webview.loadUrl(urlPlayBuzz);
But my requirement is to only load the script and display the content:
String script = "<center style=\"width:100%;\"><script> (function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id))return;js=d.createElement(s);js.id=id;js.src='//embed.playbuzz.com/sdk.js' ;fjs.parentNode.insertBefore(js,fjs);}(document, 'script' , 'playbuzz-sdk' ));</script><div class=\"playbuzz\" data-id=\"9ed89fec-22cb-441e-b2a3-69b3bd1e6953\" data-show-info=\"false\" data-show-share=\"false\" style=\"width:100%;height:56.25vw\"></div></center>";
I tried this option:
webview.loadUrl(script);
and also:
webview.loadData(script,"text/html","UTF-8");
both unsuccessfully, just show me the WebView
blank:
It is important to comment that if I complete the relative path that the script of the file src='//embed.playbuzz.com/sdk.js'
has, it does not work completely.
How could I load a "playbuzz" script correctly into a WebView?