Does Android Webview timeout iframe objects? - android

I have an app with a webpage called Avebury.html, and this has some javascript created by a colleague which loads a second HTML file inside it called widget. This has an iframe containing an embedded google map. Both are in the assets folder.
The problem is when trying to load Avebury.html in a webview it times out, and points to not being able to find the widget, when the link is correct.
I have tested linking straight to the widget and opening it in the webview, and it loads as it should. Both pages also work correctly in our iOS app and internet explorer.
The widget does take time to load, and I was wondering if the android webview is timing out the widget too soon, and if so is there a way to make it more lenient?
Thanks in advance.

I have found that android webview does not seam to like loading another HTML file from within the app in an iFrame. Removing the unneeded javascript and putting the iframe straight into the page bypassed the problem.

Related

Make an simple Android App / Webview & local pages

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.

Mobile Application based on the website

Im new with Android. My task is to create a mobile application based on a responsive WordPress website. I would like to be able to download some of the content of this site. Website uses HTTPS. In the first, most primitive version, I tried to use WebView. I wanted to use the following: WebView load website when online, load local file when offline. Unfortunately, only the white page appeared and nothing more. In the case of "Google.com link" a page has been loaded in an external browser (Oreo Android).
Any suggestion how should I start? The easiest way would be to download an HTML page or have access to files on the server. Unfortunately, I do not have that access.
As always -1 without even trying to help....
As I said load from cache when Internet is disabled not working. Work only WebView (without login, because CORS). So how should I face it?

loading x3dom html file is not working in android webview

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.

Saving webpage in cache using webview in android

I am working on an application where I load few websites in webview now I want to save webpages so after sometime even if there is not internet user will able to see those pages. But I am confused on how to save whole webpage in cache or any other medium. The main thing is we need to show pages back even if there is not internet.
Has anyone implemented this before. Please provide some demo code as this is my first attempt on cache..
Thank You
The easiest way is save webpages in cache directory or any other(Internal or external storage)
You can get the data of web page using HttpClient.execute() or HttpClient.get() now store that data in .html file also you have to download images or other contents which are bind to that page, Now in your application you have to check for connection if connection not available then load the page which one you saved in storage with file://<location of your webpage..>
EDIT:
I think using HTML5 you can display off-line webpages. (I never tried this, but I referred some blogs on it). Look at this nice post about HTML5 Creating mobile Web applications with HTML 5, Part 3: Make mobile Web applications work offline with HTML 5 Also this
hope this will help you.

Android WebView loading dropbox shortened URLs

I am making an application that creates and allows the user to edit an HTML file by adding notes and / or links to it. It then allows the user to sync it via dropbox so that they can view the file from any other Android device, or from a browser on their computer. In this program I have a WebView which loads the html page and shows it to the user. However if I tell the webview to load the shortened version of the URL(E.g. http://db.tt/DrSmhwq) instead of putting it inside my WebView it opens it in the browser on top of my app. If I use the long version of the URL(E.g. http://dl.dropbox.com/u/5724095/DBNotes.html) it loads it inside my WebView just fine. So I have a few questions: What is the difference between the shortened URLs and the long ones? Is there something about the URL that is causing this behavior, or is it more likely that this is an issue with the Android WebView? And does anyone know if there a way to generate the long versions of the URLs from within the dropbox Android app? Otherwise I am going to have to direct my users to go to the website on their computer and generate the long link and type it in to my app, this does not seem like a good solution.
Edit:
I made a bitly url that points to the longer dropbox url and tried to call wv.loadUrl() on that, it also opened up the browser instead of loading it into the WebView. So I am guessing that this is the default behavior for how the WebView handles redirects. Does anyone know how I can make it load the page that its directed to inside itself instead of a browser window?
What is the difference between the shortened URLs and the long ones?
The server is issuing a redirect, which you are not handling, so the default WebView behavior is invoked -- open the new URL in the browser.
Does anyone know how I can make it load the page that its directed to inside itself instead of a browser window?
Implement a WebViewClient, particularly shouldOverrideUrlLoading(), to handle the redirect. Attach an instance of your WebViewClient to your WebView via setWebViewClient().

Categories

Resources