JavaFX WebView - open links in system browser - java

I'm using WebView for rendering both my own generated content and remote resources (like youtube videos) in iframes. I want the stuff I load into webview to load inside the view, while any links a user clicks should open in the system browser.
I tried to use the following link:
http://www.vg.no');" href="">test
but in java 1.8.0 it caused the JVM to crash, while in 1.8.0_05, it causes the content of
the webview to be cleared.
What is the correct way to to this?

Related

full height of webview website second page

I have a webview with the following problem: on android and desktop it works perfectly on the first page, but when I click the button to go to the second page, the height of the page does not show entirely. Only in android, the scroll and buttons are not responding, desktop is fine. It's an android project downloaded from another github user...
This is the first page working great
This is the second page issue with scroll and buttons
This is the XML layout code file:
xml code part one
xml code part two
and here are the more important lines about the webview settings located in MainActivity.java file
mainactivty.java webview settings
NOTE: Normally the website is responsive and working perfectly, whatever android, ios, etc... device, its totally responsive and works fine into a web browser in mobile device, tested physically with real device (no android emulator)
The issue is only with the second page...
remove the web view from the NestedScrollView and make it match_parent

How to make JavaFX WebView skip some specified sub-urls?

How to make JavaFX WebView skip some specified sub-urls when loading a big web page? For example, making it not download images.

Android WebView and html5 vids

Please, is there any way to force WebView to play html5 embedded vids? I spent two days tempting it (from just enabling js and plugins with hardware acceleration to using html5webview class) and made video tag working, but embedding with iframe only shows me preview.
Any suggestions, please?
Does it play if you click on it manually? There are all sorts of things that may go wrong with HTML5 video on the internet, on Android you also have to take into account the various permissions.
Try this first:
Load the webpage in a browser - does it work?
Load the webpage in the browser on the device, does it work?
Load the webpage in the webview, does it play when you click on it?
There should be an auto play property on the webview, but I know that one IOS at least that one is ignore and the video won't play until you click it.

Switching from WebView to other views in Android

I am developing a photo sharing app for Android. I have a web site that I want the Android to get WebViews for most of it, but I want the android to have a native home screen rather than the web site homescreen.
As of right now, I open a WebView for login (this is needed because i must login with twitter) but after that I want the android to go to its own native home screen rather that the web site home screen.
I have tried using the shouldOverrideUrl() method to no avail. Is it even possible to program and android app to switch from the WebView at a given url?
Just create a method to check for the URLs to catch. Then make it not call the URL and open the home screen.

Is there a way to pre-cache a web page for viewing with an Android WebView?

I've read about the HTML5 cache manifest, and I've seen Android does support caching websites using the cache manifest. I want to use the cache manifest to download all the required resources for my website to preload it, and then open a WebView and display the remote website using the pre-cached resources. I want to pre-cache my remote page somehow, preferably without using a WebView for the caching process.
The problem with using a WebView for the pre-caching process is that loading the webpage using a WebView renders and executes the page instead of just downloading it.
I've read this: http://alex.tapmania.org/2010/11/html5-cache-android-webview.html, but having a WebView support caching is not what I want. I want the loading process to be instantaneous (assuming the cache manifest / etags of the remote website are the same as the cached version) right after I finish pre-caching the resources, instead of waiting for the WebView to load up and cache everything on the first access.
What is the correct way of pre-caching web pages for viewing later?
Thanks!
What you want to do requires implementing a mechanism for app cache, linked resources, cookies, and local database store for HTML5 apps that use database API, and that's an important part of what browsers do in these days. I don't recommend doing the caching by yourself, not only because it's so much work, but also because I can't recall any method in WebView and it's friends (WebViewClient, etc.) that accepts an outside cache.
But your problem has a very simpler solution: you can put a WebView in your view and set its visibility to gone. Then make it visible when it has finished loading the page. WebView also automatically keeps the cache for your app so that the next time it runs it loads the page more quickly.
For hiding your WebView and then automatically showing it you just have to override onPageFinished in WebViewClient.

Categories