Search code examples
facebookwebviewtitanium-mobileappcelerator-mobile

Webview in bottom of page


I am making an app and i want to have the facebook "Like" button in the bottom of a page. Is it even possible? I have played around with different things and this is what i have right now. var win = Ti.UI.currentWindow;

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);

Am i going about this wrong? Should i have HTML5 or XFBML instead of iframe? I have tried all three but with no result. I just get: Error loading app://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=234826439948817

Is it another way of doing this?

Thanx //R — asked 6 hours ago by Rickard Harrysson


Solution

  • I'd recommend not using a webview for it - try using the Ti.Facebook module. That will give you a lot more flexability in allowing the user to login to Facebook via Titanium. See the KitchenSink for examples.

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

    If you must use a website, the html must be a full webpage, not just the iframe. It should start with <html><head/><body>. I recommend creating a webpage outside of Titanium that works, then plug the html of that page in the html property.