I want to load a webpage related files to a web view in my android application. I tried loading the webpage main html file(index.html) into the web view and it successfully loads. But the problem arises at the part where the other assets(like css files, images, js files) are not making it look like it should. Only the html part is loaded while other are left behind.
This is the output how is it looking like
Instead it should look like this
The rest of the assets files are not getting linked. Can anyone help?
Here the link is my Html source Code:
https://docs.google.com/document/d/1upMVriZoXuBVlmTXSqjN0EVY9O48T9sEnXOpToLW4CQ/edit
Related
I am trying to build a simple app, using Webview.
I just want to create an app that contains 2 html files (stored in assets folder). At loading, app display page1.html in webview.
On this page, there is a link to page2.html (in html format : href=""). I need this page opens also in webview.
I tried, but when I click on the link, the app closes... I tried href="page2.html", href="file:///android_asset/page2.html"... Nothing works.
Do you have any example of a simple app like this ?
Thanks.
I am trying to load x3dom html file in android web view. when I try to load x3dom file in browser "chrome" in android it works fine. But when I load it in web View the scene is not full showing. I update web view but still not working. Its controls works fine but it shows only small portion of the scene. The same thing happens when I load three.js website 3d examples in web view. As there any custom web view which support WEBGL fully like browser. Or any other Help will be appreciated.thanks
Please try to use AdvancedWebView. You can find that on GitHub.
im a new android developer.
My app has WebView which loads lot of data from my site (which has pics, css, JS files).only the html code is updated weekly. other files are almost never changed. so i was thinking of including these static files in android assets, loading only the html from server and other files from assets and cutting down the loading time. how do i do it.
Android WebView Javascript from assets
and as shown in the above solution i cant change the html code to load these from assets because this site will also be accessed by web users.
Is there a way to do this. Thanks in advance..
Firstly you need to have relative paths
<img src="images/someimage.png">
not
<img src="www.mysite.com/images/someimage.png">
Then you need to load the HTML code not using webBrowser, for example like here
And then you can load HTML source into WebBrowser using base URL pointing to your assets like here
I want to load a part of Website to Webview. Not completed Website.
How can I do it?
It is similar this question.
Load a div into a webview on Android
But the answer only load text. not have Image.
Any one there?
1.Create a HTML file with a frame (or iframe) in it and save it in your assets folder.
2.Load your file in webview from assets .
I am developing an Android application in which I have a WebView. I want to save the entire webpage loaded in this webview (Html + all resources + images + icons etc) into a folder and zip it and upload it to a server.
If you use WebView's saveWebArchive, then it is saved in archive format. How do I get the Html and images back from this archive? Is there any documentation for the format of this archive?
If I use addJavaScriptInterface to get the html as described here, I still have to copy the images and other resources from the webview cache dir (/data/data/your app package/cache/webviewCache/). However I did not find webview cache dir (/data/data/your app package/cache/webviewCache/) in Icecream Sandwich.
Is there a way to save the entire webpage displayed in webview along with resources in Android?
Thanks
If anyone is still interested, there is an open source project here that can read WebView's archive format (saved with saveWebArchive) and display it back in a WebView.
https://github.com/gregko/WebArchiveReader
I couldn't find details of the actual format yet.
You can use HTML 5 to store pages in the cache and load from the cache itself.
Caching is easy using HTML5, all you have to do is to make and refer a manifest file that holds information on what all elements need to be cached.
http://www.html5rocks.com/en/tutorials/appcache/beginner/
And here is a good way to implement the cache feature in your webview. http://alex.tapmania.org/2010/11/html5-cache-android-webview.html
Aman Gautam