Frank
Frank

Reputation: 2173

Open Youtube link using the system app or the external browser

I have cordova 5.4.0 and I need to open a Youtube URL like this: https://www.youtube.com/results?search_query=example making user to choose between the Youtube system app (iOS, Android etc...) or any external browser. Is it possibile to do that using the InAppBrowser plugin or even without it?

Thanks

Upvotes: 1

Views: 1913

Answers (1)

shamon shamsudeen
shamon shamsudeen

Reputation: 5848

Yes it is possible

document.addEventListener("deviceready", onDeviceReady, false);
    function onDeviceReady() {  
        var url="https://www.youtube.com/results?search_query=example"   
        openUrl(url);
    }
    //for launch  website
    function openUrl(url){
       //opens inapp browser
        window.open(url,'_self');
       //opens system browser
        window.open(url,'_system');
    }

Upvotes: 2

Related Questions