I'm trying to show facebook embedded post inUIWebView
.
I get sample code from facebook developer portal and load it into UIWebView
.
And see only blank screen.
Then I put this code in local html file and opened it in Chrome. Still nothing, but i see that embed appeared in half second and then vanished. I try many different embedded html examples with same result.
Here is my code:
<html>
<body>
<div id="fb-root"></div>
<script>(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.src = "https://connect.facebook.net/ru_RU/sdk.js#xfbml=1&version=v2.3&appId=334367389999440";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-post" data-href="https://www.facebook.com/FacebookDevelopers/posts/10151471074398553" data-width="500">
<div class="fb-xfbml-parse-ignore">
<blockquote cite="https://www.facebook.com/FacebookDevelopers/posts/10151471074398553"><p>Be the first to know
when we release a new video by subscribing to our official Facebook Developers YouTube channel!
http://www.youtube.com/facebookdevelopers</p>Posted by <a
href="https://www.facebook.com/FacebookDevelopers">Facebook Developers</a> on <a
href="https://www.facebook.com/FacebookDevelopers/posts/10151471074398553">29 Май 2013 г.</a>
</blockquote>
</div>
</div>
</body>
</html>
I don't find any reason of adding script in the HTML, as you said you have found sample code in FB docs.
Below code is working fine:-
The only way to resolve the problem is create a proxy service with facebook-embed. Before insert your HTML-code into UIWebView check it for fb-post and fb-video:
And my remote page source code (PHP Phalcon Controller):
Example (blured text is my HTML over fb-embed):