我正在尝试从我的android应用程序打开Facebook应用程序页面,instagram应用程序页面,twitter应用程序页面(如果有可用的应用程序),或使用phonegap在默认浏览器中打开页面。没有安装,它没有显示任何操作。这是下面的代码。
<a class="intent" href="http://facebook.com/mypage/" data-scheme="fb://page/123456789101112131415"><img src="img/facebook.png" alt="mypage.fb" id="facebook" ></a>
<a class="intent" href="http://twitter.com/mypage/" data-scheme="twitter://user?screen_name=mypage"><img src="img/twitter.png" alt="mypage.twt" id="twitter" ></a>
<a class="intent" href="http://instagram.com/mypage/" data-scheme="instagram://user?username=mypage"><img src="img/instagram.png" alt="mypage.insta" id="instagram" ></a>
<script>
$('a.intent').on('click', function (event) {
//var facebooks = "http://facebook.com/mypage/";
goToUri($(this).data('scheme'), $(this).attr('href'));
// we don't want the default browser behavior kicking in and screwing everything up.
event.preventDefault();
});
// tries to execute the uri:scheme
function goToUri(uri, href) {
if (!window.open(uri)) {
window.location = href;
}
}
</script>
有人可以通过提供解决方案来帮助我吗?