How do I run a function cordova if the command embedded in external sites?

两盒软妹~` 提交于 2019-12-14 03:21:54

问题


I want to run a function to open the link in the android browser system. Here is an illustration of my questions. See the illustration What should I do? I only use javascript not java. Please help


回答1:


Some time ago I encountered the same problem. To do this I modified the InAppBrowser source code. you should override the shouldOverrideUrlLoading method in the InAppBrowserClient class found in InAppBrowser.java

This will allow you to hook in to the request before the url is being loaded and choose an alternate behavior. In your case loading the URL in the system browser.

Your code will look something like this:

@Override
public boolean shouldOverrideUrlLoading (WebView view, String url){
    if(url.equals("Your URL to be loaded")){
        openExternal(url);
        return true;
    }
    return false;
}


来源:https://stackoverflow.com/questions/27718204/how-do-i-run-a-function-cordova-if-the-command-embedded-in-external-sites

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!