Resizing an Appcelerator WebView accordingly to it's content (YOC Ads)

447 views
Skip to first unread message

Marco Schierhorn

unread,
Feb 22, 2012, 8:17:59 AM2/22/12
to appcelerat...@googlegroups.com
We are currently in the process of adding ads from YOC and
smartadserver.com to an iPhone and Android App we develop with
Appcelerator Titanium.

Now we would like to embed the JavaScript calls from the
YOC/smartadserver JS SDK in a Webview, here I'm looking for the best
approach.Until now I do this with the help of jQuery and some kind of
listener, which is called every 100 ms. It look at all children (tags)
of the body, what the highest and broadest values are and after that
it calls a Titanium function which tries to adjust (accordingly to the
changes of the ad html) the WebView in the app. It works actually
quite good, but maybe there are other more elegant solutions. I had
seen that there are several JS variables that I could possibly also
check whether there were changes in size or a click event. And i may
not get a feedback of some Ads which open up a new window and also get
a new height and width because of that. So that's why I'm looking for
the ideal variant. Any help or suggestions would be highly
appreciated.

Here are 2 links to the functions that I use:

Here is the function which creates the WebView and the close button:
http://pastie.org/3428595

That's the content of the WebView: http://pastie.org/3428600

Thanks, Marco

Reply all
Reply to author
Forward
0 new messages