Webview preload
Is there any way to force a webview to load before I actually display it?
Essentially what I need to do is update a hidden webview with information relayed from a current webview…
5 Answers
-
Dan's idea of hiding the webview until the content is loaded works for me. (My client asked me to simply remove the activity indicator when the web view initially loads, and surprisingly, we don't have that ability through Ti, as far as I know.)
Here's what worked for me:
webview.addEventListener("beforeload", function(e) { webview.hide(); }); webview.addEventListener("load", function(e) { webview.show(); });
-
I don't believe there's a way to preload it, but perhaps you could use the webview's load event and keep it hidden until that event fires?
-
Hmmm…I guess maybe you could load that HTML content to a string with an ajax call when your app launches, manipulate that string to contain the data you need from the current webview, then load the new webview and use it's html property instead of it's url property for what content to display.
I've never tried it quite like this but it sounds good in my head. :)
-
I do this a lot…. I load the html via XHR and then prebuild the window with the webview before open it….
when the HTML is finished loading via XHR I put the HTML to the webview and then I open it…. which will render instantly…. -
doing
tabGroup.activeTab=3; tabGroup.activeTab=0;
really quickly worked for me.