Search code examples
javascriptandroidhtmlandroid-tabhost

Load JavaScript file common for all HTML files


I am creating android application using Tabhost and having the following

1. App having 4 tabs
2. Each tab in Tabhost having WebViews. 
3. Loaded local HTML files with these WebViews.  
4. 4 Local HTML files having more than 8 js files. 
5. but 8 js files are same for all HTML files

Issue: i can load 8 js files separately in each HTML files. This affects performance

Expected: We can load all java script files in Layout.cshtml file when we using ASP.NET MVC pages. Like that i want to load all js files common for all local HTML files.

Please guide me


Solution

  • I guess this will not be possible because the WebViews are independent containers running separate WebKit engine in each instance.

    One possibility in your case would be to emulate the TabHost user interface with a single WebView. To be specific, you would have to create the tabs using web content itself, so that you make use of a single WebView, which contains HTML for the 4 different tabs in it.