2012-05-26 70 views
0

我正在製作一個應用程序,我想在頁面底部有一個Facebook「贊」按鈕。 它甚至有可能嗎?我玩過不同的東西,這就是我現在所擁有的東西。 var win = Ti.UI.currentWindow;Webview在頁面底部

win.showNavBar(); // Force the navbar to show 

var bgImage = Ti.UI.createImageView({ 
height : 'auto', 
top  : -11, 
image : 'images/h-4.jpg', 
zIndex : 0 
}); 
win.add(bgImage); 

var ticksterImage = Ti.UI.createImageView({ 
height : 'auto', 
top  : 1, 
image : 'images/takida.png', 
zIndex : 0 
}); 
win.add(ticksterImage); 

var facelike = Ti.UI.createWebView({ 
html: '<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Ftakidamusic&send=false&layout=standard&width=320&show_faces=true&action=like&colorscheme=dark&font&height=80&appId=368268836546636" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:320px; height:80px;" allowTransparency="true"></iframe>', 
height: '80dp', 
bottom: 1, 

}); 
win.add(facelike); 

我該怎麼處理這個錯誤?我應該有HTML5或XFBML而不是iframe?我已經嘗試了所有三個,但沒有結果。 我剛剛收到:Error loading loading:http://www.facebook.com/plugins/like.php?href = https%3A%2F%2Fwww.facebook.com%2Ftakidamusic & send = false & layout = standard & width = 320 & show_faces =真&行動=像&色彩方案=暗&字體&高度= 80 &的appid = 234826439948817

是不是這樣做的另一種方式?

感謝名單 // [R - 問3小時前由裏卡德Harrysson

回答

0

我建議不使用的WebView它 - 嘗試使用Ti.Facebook模塊。這將使您在使用戶通過Titanium登錄Facebook方面有更大的靈活性。以KitchenSink爲例。

https://github.com/appcelerator/titanium_mobile/blob/master/demos/KitchenSink/Resources/examples/facebook.js

如果你必須使用一個網站,該HTML必須是一個完整的網頁,而不僅僅是iframe中。它應該從<html><head/><body>開始。我建議在Titanium之外創建一個網頁,然後將該網頁的html插入到html屬性中。

+0

好的。我已經與其他選項一起去了。但是你的意見很棒。感謝名單! –