Taking a quick look at the InAppBrowser.java Android implementation, seems
we just inject a <script> tag with its src set to exactly what you provided
as the url. Since the src is relative to the IAB page, I would imagine the
examples as written are misleading.
I'm not sure if its possible to format a url in a way to load a local asset
from within IAB, but you can inject a block of code directly with
ref.executeScript({code:
...}).
All this said -- would you mind just trying the various examples and
reporting back & submitting PR to update the docs accordingly?
Thanks!
-Michal
On Mon, Nov 3, 2014 at 8:46 AM, julio cesar sanchez <[email protected]>
wrote:
> Looking into the inAppBrowser code, it seems to me that the insertCSS and
> executeScript are for injecting an external CSS or JS, but looking at the
> code example, it seems (to me), that an internal file could be loaded
>
> insertCSS example code:
>
> var ref = window.open('http://apache.org', '_blank', 'location=yes');
> ref.addEventListener('loadstop', function() {
> ref.insertCSS({file: "mystyles.css"});
> });
>
> executeScript example code:
>
> var ref = window.open('http://apache.org', '_blank', 'location=yes');
> ref.addEventListener('loadstop', function() {
> ref.executeScript({file: "myscript.js"});
> });
>
>
> So, can anybody confirm if this two functions are only for external
> files? or is it possible to load files from www folder?
>
> If only external files are possible, then maybe we should change the
> example codes to something like
>
> var ref = window.open('http://apache.org', '_blank', 'location=yes');
> ref.addEventListener('loadstop', function() {
> ref.insertCSS({file: "http://www.example.com/mystyles.css"});
> });
>