cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Mocny <mmo...@chromium.org>
Subject Re: InAppBrowser insertCSS/executeScript with file option code example is confusing
Date Mon, 03 Nov 2014 15:43:02 GMT
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 <jcesarmobile@gmail.com>
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"});
> });
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message