WebView Android 5 doesn't open links with target=_blank - android

I recently detected an issue what I can only reproduce with a Samsung Galaxy S5 and Android 5.x (not with a HTC One, Android 5.x).
When opening a link in a WebView (target=_blank), then nothing happens. I can see an exception in the Logcat output, but the WebView WebViewClient Method shouldOverrideUrlLoading is never called (There I create an intent what opens the url).
My current workaround is to remove the target=_blank from all links - but does anyone knows if this is a Bug or a normal behaviour and I've set something wrong?
Thanks

Related

Oreo - unable to set fresh values through setUserAgentString in WebView

I am facing an issue in WebView in devices running API 27 (8.1.0).
I pass off my params in the userAgentString based on which a php page loads the appropriate data. When I open the WebView for the first time it works well.
However, whenever I open the WebView after this first time (I call setUserAgentString each time I load it, with fresh values), it persists with that old value of userAgentString, thus not loading the correct data. This happens irrespective of whether I am in the same activity and re-using the same WebView, or move to a different activity where a new instance of WebView is used.
The following devices gave this odd behaviour -
Google Pixel 2XL, version 8.1.0
Xiaomi Mi A1, version 8.1.0
...and the webview was working perfectly on the following devices, not showing this behaviour -
Samsumg GALAXY Tab SM-T825, version 8.0.0
Moto G4, version 7.0.0
HTC Desire 526, version 4.4.2
I think this could be linked with how the Android Webview implementation has been changed to Chrome in Oreo.
However, the behaviour did not change irrespective of what I set as "Webview Implementation" in Developer settings, implying that may not be the cause.
Additionally, only when I clear data, or do a fresh install, is the userAgentString value reset.
I have read dozens of posts on SO, and tried all sorts of methods related to WebView and WebSettings, but I haven't managed to find a solution.
What am I missing here?
Maybe, this code can help you.
webView.clearCache(true);
webView.clearHistory();
webView.getSettings().setAppCacheEnabled(false);
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
Lucky :)
I experienced this issue recently and the problem was that the device had an outdated Chrome WebView framework. Simply update it via the Play Store and the issue should resolve.

Samsung S6 and S6 Edge WebView Issue

I have an activity which handles any URL events within my application and it opens them within a web view. The issue which I currently have is that if i turn off the WiFi and turn it back on the URLs which were previously working before in the webview do not load and it eventually timeouts. The puzzling thing is that I have tried this within the same application across other phones (HTC, Samsung S5, LG Nexus 5, Samsung S4, One Plus One) and it works perfectly.
I am wondering if anyone has a solution for this or at least an explanation as to why this is happening.
The reason I'm asking this is on here is because although it seems to be a device specific issue, before to get another issue with my webview to work with samsungs i had to enable webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
I want to know if there would be something similar to help me with this S6 issue.

I see ad landing page rendering issues on some devices for my app, mostly on samsung. How should I investigate it?

So I have an app wherein ads appear at the bottom of the screen. When the ad is clicked, landing page should open in the device browser. However in some cases, it opens in the bottom area on the app itself (where the ad is shown). Has someone else also faced this issue? How to drill down to the reason? How to fix it?
I tried testing the app on a number of devices and saw the same happening for Micromax as well. The issue was seen on Samsung Galaxy : Android 4.4.2, Kernel version 3.4.0, Chrome 37.0.2062.117; and on Micromax: Android 4.4.2, Kernel version 3.4.67, Chrome 35.0.1916.141
I also tested the landing page url on mobi.ready and it reported some XHTML markup issues. Is that the reason?

Android stock browser on Xperia Z does not render html correctly

I have an HTML page which is displayed correctly in all devices and all browser except the stock Android browser in Xperia Z.
On this particular device running Android 4.2.2, I am using jQuery v1.7.2, and using $('div').slideUp and $('div').slideDown methods only, and it results in text distortion (it is in English, so I suppose it is not related to any specific font), the text appears as horizontal lines as they would appear for a fraction of a second while sliding up/ down.
I have tried turning the debug mode ON by about:debug in the stock browser, and the javascript console shows no error/ warning messages.
I tried changing the user agent string to iPhone, and to my surprise, the text is rendered as expected.
I have searched for similar issue, and came across Android stock browser crashing, it points to jQuery bug where slideUp/ slideDown have problems in Android stock browser (please note that jQuery and Android versions are different in the reported bug).
My questions are:
Is this a known issue?
Has anyone faced similar problem before?
Is there a workaround to resolve it?
I'd really appreciate if anyone could point me in the right direction.

Facebook API for Android displays blank window

I am using the Facebook API to post messages to Facebook from my Android app. I have tested it out on various different phones, yet on one particular phone the Facebook API just pops up a blank white dialogue window that doesn't load the FB log in page.
I have tested it on the Samsung Galaxy S, the HTC Desire, HTC Sensation and it works fine - but when I try it on the HTC Wildfire S it does not work.
There are no messages popping up in LogCat and stepping through it with the debugger does not reveal any problems.
Looking through the code provided by Facebook I can see it is just a WebView which is being created. There is a function called onPageFinished(..) which gets called but there is nothing in the WebView.
I'm not really sure what to try to fix this. I've tried clearing some settings on the phone but that did not work. Does anybody have any ideas?

Categories

Resources