Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (webview)
Viewing all articles
Browse latest Browse all 680

is it possible to prevent webviews on scrollableview from reloading when adding new views to the scrollableview?

$
0
0

example code:

var win = Ti.UI.createWindow({backgroundColor: 'black'});
 
var scrollableview = Ti.UI.createScrollableView({
    top: 0,
    height: 300,
    cacheSize: 10,
});
 
var webview = Ti.UI.createWebView({
    html: '<html><head></head><body><script>var now = Date.now(); document.body.innerHTML = now;</script></body></html>',
    top: 0,
    height: 300
});
 
webview.addEventListener('load', function(){
    alert('The webview is loaded!');
});
 
var b = Ti.UI.createButton({
    title: "add new view",
    top: 400
});
b.addEventListener("click", function(){
    scrollableview.addView(Ti.UI.createView());
});
 
win.add(scrollableview);
scrollableview.addView(webview);
win.add(b);
win.open();
as you can see, every time when adding a view to the scrollableview the webview is reloading.

is it possible to prevent this behaviour? because it is really unnecessary.

thank you!


Viewing all articles
Browse latest Browse all 680

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>