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.
Related
so i found a way to open pdf file using open_file but now i want to open with specific page.. for example there is 10 page and i want to navigate to page 5 as initial page when it is done opening from default app.. is there a way to achieve that?? i want to avoid open pdf in app using other plugin.. the thing is i have like 360 page pdf and i want user to be able to open to specific page when he pressed a button...
open_file plugin can't do that.
here for android source code and here for iOS source code.
You may change to another plugin such as syncfusion_flutter_pdfviewer or any one can do this.
Currently I'm developing a website (that mainly runs in iOS WKWebView) and a native iOS app.
Normally, if I want to select some image or video to upload in webpage inside webview, this is what happens:
Click html input tag (ex. <input type="file" ... /> )
Choose 'Photo Library' option
Choose images or videos and click add
Files are loaded in webview
Question:
Is there any way to do some stuff in between 3 and 4?
For example, can I select a video file, modify it, and then pass the modified file to browser?
In Android WebChromeClient, it handles html input tag with onShowFileChooser which has callback to return the list of selected files to the browser. In this scenario, the app can do whatever stuff before passing the result to the callback.
Does iOS webkit have some equivalent method like this?
Or, is there a way to manually select files from native app and pass it to the html input tag inside webview?
Let's say I have an Android app that uses a webview. Inside that webview I have a link to download a PDF file like so:
<a href="LinkToDownloadPDF" target="_blank".../>
In a browser (Say Chrome for example), this will either download the file or opens it in a new tab.
My question is, what will happen once the webview is charged in the Android app? Will it download the file or open the web browser?
Nothing will happen when you download from webview without setting the download listener.
If you want to implement the feature of downloading something inside WebView, have a look at this question: Download File inside WebView
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.
I'm using the epublib Android library to read an existing EPUB, and I can't get internal links to work.
One of the chapters has HTML like this
Click here
but when you actually click on it, you get an Android webview error:
The webpage at file:///data/data/com.temp.package/library/epub/9_epub_files/9781484702181.xhtml could not be loaded.
I've tried changing the URL like this but neither works.
Click here
Click here
Is there anything I need to do in particular to get internal links to work?