I am trying to create an app that has a Webview to view a site (with full navigation). The problem is the site requires Chrome. I tried setting the user-agent but that did not work.
In order to get around this I used
webview.setWebChromeClient(new WebChromeClient(){});
This was able to bypass the sites browser check.
The problem I have now is I cannot seem to navigate the site without it opening the default browser app.
I tried using the WebChromeClients onRecievedTitle method but with no success.
Is this even possible? If so, can anyone point me in the right direction?
Related
I have searched through all sources I could find and tried everything, but can't seem to find a solution. I have a website (Angular 7 form) that runs perfectly on all devices and all browsers BUT when I posted a link on Facebook, on Android phones it opens in Facebook's WebView browser and crashes when hitting the first button or when pressing the three dots in the browser corner. The WebView browser works well on some Iphones, but some have the same issue. Also the css stylings are not similar, the background is not covering the whole device and button is almost not visible. I tried posting a link straight to the other pages on the site, and always when navigating to next page on the router or tapping basically anything on the page, it crashes.
Some testers claimed that they could make it to the third page (out of 8), and then it crashed.
I've read about fixes and tried the following:
Removed Google Tag manager script, since it was inside an Iframe
Changed CSS styling so that there are no width/height values in
pixels or percents
Added viewport meta tags
Checked that all URL:s are https
Removed target="_blank" from a link on the last page
Changed CSS styling so that positions are absolute
Is there something else that the WebView doesn't support? Where do I find this information or should I just keep guessing? Is there a way to debug the WebView somehow, when it's not my own app's WebView but Facebook's?
Thanks in advance, this is such an annoying problem! Unfortunately this website is the kind that will be published through social media.
So I finally solved this (workaround), with only one line of code. My workaround is to redirect the user to an external browser, when it tries to open in Facebook's or Instagram's In App browser.
I detect if it's FB or Instagram and then run this line of code in the html:
<meta http-equiv="refresh" content="0; url=intent://YOURURL#Intent;scheme=https;action=android.intent.action.VIEW;end;" />
Hope this helps someone, these In App browsers seem to be a real pain!
I am trying to open a link in chrome from a webview on android. Is it possible to do this with the URI rather than using an intent.
For example doing something like "chrome://www.google.com"
I have been looking around on here and other places on the internet seeing things like googlechrome:// and googlechrome://navigate?url= as well, but I cannot seem to find anything that works.
Thanks in advance!
I was not able to force it to open in chrome, however, I was able to force it open in the android browser by replacing "https" with "browser." I still do not know if it is possible to force it out of the webview and open it with chrome, but this solution works for my purposes.
Web links are not clickable in android chrome and firefox. But in Opera it is working. It is created with Twitter bootstrap :
http://questionfriends.com/
Even in computer if you resize the browser to minimum width the links doesnt seem to work. It has something to do with the scalfolding javascript that is making the links as simple "#" .
While if you maximize it on desktop the link seems working. Some scalfolding code is removing the hyperlinks with dummylinks. Just check if any javascript is doing it,
I created a WebView (with JavaScript enabled) in my app to display a link programmatically. I send the url to it, and it loads. I do the same thing, instead sending it programmatically to a browser on the phone.
These look like the first picture.
The problem is the page displayed in both of these cases is different than if I copy and paste the link (generated in the app from the Log) to the same browser on the device manually, or open it on my desktop browser. These look like second picture.
A sample link is:
http://lyrics.wikia.com/index.php?title=Future:Karate+Chop+%28Remix%29&action=edit
Why could this be?
Sounds like you need to override the shouldOverrideUrlLoading in your WebViewClient, which should be attached to your webview, also in the overriden method it should return false if you want your webview to handle it.
The second thing I would recommend would be to also change the UserAgent that is being attached to your WebVIew as well since you're seeing a difference in Desktop/Mobile version of the website.
You can learn more about tweaking the user agent here:
Want to load desktop version in my webview using uastring
I experimenting with WebView in Android and I can't figure out how to make it work like the native browser.
I have an example for this:
Go to deviantART.com in native browser. Press Menu button. At the bottom of the menu there will be a link to disable mobile view and it works as expected. This exact same thing doesn't work in WebView. It simply turns the menu off and that is all, mobil CSS still stays intact.
I need to make users disable deviantART's mobile CSS, so I need the WebView to work like this.
JavaScript and DOMStorage are enabled.
I need the proper code or an workaround, but after hours of searching I didn't find anything that connected to this problem.
Thank you in advance.
If all you want is to turn off the mobile view you can set the user-agent string on the WebView using setUserAgentString (String ua).