我正在尝试让我的PhoneGap应用程序链接到Twitter应用程序中特定用户的个人资料页面。我知道并非每个人都在设备上安装了Twitter应用程序,所以如果他们没有安装,我想将他们发送到Play商店下载它。
问题是,每次我在Android设备上点击链接时都会收到一个错误:
问题是,每次我在Android设备上点击链接时都会收到一个错误:
Application Error:
net::ERR_UNKNOWN_URL_SCHEME(twitter://user?screen_name=xerxesnoble)
我的JavaScript代码如下:
//If Android
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
if (isAndroid) {
alert('Android!');
twitterCheck = function() {
alert('Android!');
var now = new Date().valueOf();
setTimeout(function () {
if (new Date().valueOf() - now > 100) return;
window.open('https://play.google.com/store/apps/details?id=com.twitter.android', '_system', 'location=no');
}, 50);
window.open('twitter://user?screen_name=XerxesNoble', '_system', 'location=no');
};
};
$('.twiterNav').click(function() {
window.open('twitter://user?screen_name=xerxesnoble', '_system', 'location=no');
});
我尝试过的事情:
- 使用
twitter:///
而不是twitter://
- 将
<access origin="twitter://user?screen_name=xerxesnoble" />
添加到我的config.xml
中
我不确定还有什么可以尝试,Facebook也不起作用,但现在我一次只专注于一个问题。