So I have a html app that I'm loading in a WebView. The thing is I want to use shouldOverrideUrlLoading not to load a specific link, when it gets clicked, so I return true in that method, not loading the url. This works great, but the link is getting highlighted as if it was clicked. Is there a way that I can remove the highlighting if the link was pressed but not loaded?
Thanks
You could have one of a few problems, Clicking on the link in android webview does not get highlighted visually says you have to set Javascript as enabled with:
webView.getSettings().setJavascriptEnabled(true);
There's also been an issue with focus at Android:Webview with link highlight, where you should request focus on your webview with:
webView.requestFocus(View.FOCUS_DOWN);
Related
I have loaded a url in webview, when I click on a button a new view appears in the webview without changing the url. Is there any way to capture this state change in the webview?
yeah checkout https://developer.android.com/reference/android/webkit/WebView#addJavascriptInterface(java.lang.Object,%20java.lang.String) using js interface is the only way to register changes in the webview
I have a list and when I click on one item of the list, one HTML page is called like that:
webView.loadDataWithBaseURL("file:///android_asset/", content, "text/html", "utf-8", "about:blank");
Inside this webview, there is HTML5 video (I'm using this library https://github.com/cprcrack/VideoEnabledWebView). When I enter in full screen mode with the video, then return to the list and click on another item to load an HTML page, this page takes too long to load (like minutes).
This only happens on some 4.4.2 devices, on the emulator it loads quickly.
My hardwareAccelerated is enabled.
I found out that if I rotate the screen, the second page loads quickly. But I tried to reload the page ou setting to clear the view, but it didn't work.
Does anyone has any idea why this happens?
I'm also getting this error:
[ERROR:in_process_view_renderer.cc(193)] Failed to request GL process. Deadlock likely: 0
If your working on web view i would suggest to look on crosswalk and chromium. Its best way to bring in hardware acceleration into the project.
In android app I have webView page that use jquery plugin for lazyload. In mobile browser it work fine but not in webView. After debug I find out that even this doesnt trigger alert.
$(window).scroll(function() {
alert("Scrolled");
}
Does there is special way to handle scroll events in webView?
PS For lazy load i use this plugin http://www.appelsiini.net/projects/lazyload
window.onscroll works with the WebView. Some things to check:
you have placed the WebView in a ScollView and/or set it's height to wrap_contents,
the contents of the WebView is too short to scroll,
you haven't implemented the WebChromeClient.onJsAlert callback to handle alert. By default the WebView doesn't display a popup.
Guys i have a WebView in my Screen with some TextFields in it. Whenever i click on a TextField my keyboard is opening along with that my WebView is Zooming automatically.How to resolve it.Any Suggestions
Thanks&Regards,
Venkat.
You could try overriding the standard behaviour of your webview by using a WebViewClient.
More info on those can be found here. Numerous examples of the implementation of the WebViewClient can be found by simply googling it.
I'm developing an application which is mainly a webview and will display a JQTouch UI. Two of the 3 views work just fine, however, I have a view which loads another page with a form which does not work at all. This view loads up just fine but when I click the link to go to the form the link just stays highlighted and nothing happens. I have overriden all of the methods in webviewclient and webchromeclient and placed breakpoints within with no luck. None of the hooks catch when I click the links.
The part that truly confounds me is that it works in the phones browser but not in my webview. Is there a setting on webview that I may be missing which would make it act like the phones browser?
Any help or suggestions would be appreciated.
The fix for this was to override onLoadResource as the link was being treated as a resource and not a new page load. I tried calling webView.loadUrl right in the override of loadREsource but that caused an endless loop so I had to write some logic to load the url properly into my webView. This seems a bit hacked but it works.