doyouknowyou Posted October 27, 2014 Share Posted October 27, 2014 I'm trying to create a button to link to an external website using Phaser and CocoonJS: function rate(){ if (navigator.userAgent.match( /iPad/i ) || navigator.userAgent.match( /iPhone/i ) || navigator.userAgent.match( /iPod/i )){ window.open("http://www.apple.com"); } else if (navigator.userAgent.match( /Android/i) ){ window.open("http://www.google.com"); }} It works fine in the browser, but when compiled with Cocoon nothing happens! Any help would be greatly appreciated! Link to comment Share on other sites More sharing options...
doyouknowyou Posted October 27, 2014 Author Share Posted October 27, 2014 Just found out the answer! For those of you that want to know... Make sure to include the Cocoon API found here: https://github.com/ludei/cocoonjs-plugins Then... function rate(){ if (navigator.userAgent.match( /iPad/i ) || navigator.userAgent.match( /iPhone/i ) || navigator.userAgent.match( /iPod/i )){ Cocoon.App.openURL('http://www.apple.com'); } else if (navigator.userAgent.match( /Android/i) ){ Cocoon.App.openURL('http://www.google.com'); }} pixelpathos 1 Link to comment Share on other sites More sharing options...
Recommended Posts