Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My android application is opening a webview in which when I click on the image in webview it shows this error---> net:err_unknown_url_scheme


for e.g

let's say I am loading facebook.com in my android app. The site is opening perfectly fine I can access everything but when I click on any image on Facebook. It shows :
net:err_unknown_url_scheme


What I have tried:

Quote:
To open the hyperlinks within the application I have used following code:

Java
public class GeoWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {

            if(url.toLowerCase().startsWith("http") || url.toLowerCase().startsWith("https") || url.toLowerCase().startsWith("file"))
            {
                view.loadUrl(url);
            }
            else
            {
                try
                {
                    Uri uri = Uri.parse(url);
                    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                    startActivity(intent);
                }
                catch (Exception e)
                {
                    Log.d("JSLogs", "Webview Error:" + e.getMessage());;
                }
            }
            return (true);
        }


Quote:
I tried to click the same image using browser URL that came after the search is--

https://www.zomato.com/ncr/wood-box-cafe-delhi-university-gtb-nagar/menu#tabtop

and this is what I get when I click the same image using webview in my app

zomatobranchsdk://open?link_click_id=5912449135
Posted
Updated 29-May-18 13:14pm
v2
Comments
Patrice T 29-May-18 14:33pm    
And what is the url you try to reach ?
nikhil arora 29-May-18 15:37pm    
buddy url is ---- the webpage at zomatobranchsdk://open?link_click_id=5912449135 could not be loaded because: net::ERR_UNKNOWN_URL_SCHEM
David Crow 29-May-18 14:37pm    
What happens if you remove that code and just let the WebView control open links directly?

Are you compiling with the latest API (level 27)?
nikhil arora 29-May-18 15:38pm    
Yes bro i am using api level 27
nikhil arora 29-May-18 15:39pm    
if I remove the above mention code then too I am receiving same error

1 solution

Quote:
url is ---- the webpage at zomatobranchsdk://open?link_click_id=5912449135 could not be loaded because: net::ERR_UNKNOWN_URL_SCHEM

As far as I know, zomatobranchsdk://open?link_click_id=5912449135 is not an url. This may be the reason of error.
First step to solution is to find what is the correct URL.
 
Share this answer
 
Comments
nikhil arora 29-May-18 17:15pm    
I tried to click the same image using browser URL that came after the search is--

https://www.zomato.com/ncr/wood-box-cafe-delhi-university-gtb-nagar/menu#tabtop

and this is what I get when I click the same image using webview in my app

zomatobranchsdk://open?link_click_id=5912449135
Patrice T 29-May-18 17:20pm    
Use Improve question to update your question.
So that everyone can pay attention to this information.
nikhil arora 29-May-18 19:11pm    
okay buddy done!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900