javascript - cordova- window.open() is not working even after adding inappbrowser pugin -


i developing hybrid mobile application using cordova. when click button need open url in website. end using window.open working fine in browser not working in mobile application after adding inappbrowser plugin.

below provide code running:

<button type="submit" class="btn btn-primary btn-sm" id="mybutton">get free trial</button>` document.getelementbyid("mybutton").onclick = function () {          window.open("https://indirect-tax.com",'_system'); }; document.addeventlistener("deviceready", ondeviceready, false); function ondeviceready() {     window.open = cordova.inappbrowser.open; } 

our directive solution globally redirect a tags, used same plugin you, without redefining window.open. can modify add rules, version redirects links href beginning "http", , evaluates code placed in ngclick attributes (you should remove safety, test version).

angular     .module('yourmodule')      .directive('a', function () {         return {             restrict: 'e',             link: function (scope, element, attrs) {               if ( !attrs.href ){                 return;               }               var url = attrs.href;               if ( url.lastindexof('http',0) === 0 ){                 element.on('click',function(e){                   e.preventdefault();                   if(attrs.ngclick){                       scope.$eval(attrs.ngclick);                   }                   window.open(encodeuri(url), '_system');                 });               };             }         };     }); 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -