Is it possible to validate the xmlns:fb (Facebook) attribute?

六月ゝ 毕业季﹏ 提交于 2019-11-30 01:40:21
copy

There is no way to validate xmlns:fb with HTML5.

However, you can use the new data-...-attributes, which were added by Facebook and are valid HTML5, as described here.

This is an example of how you can use this extension in HTML5 (assume all code is in the body element):

<h3>Members</h3>
<embed data-fb="login-button" data-show-faces="true" />
<h3>Recent activity</h3>
<embed data-fb="activity" data-site="***" data-width="200" data-header="false"
 data-border_color="#fff" data-recommendations="false" />
<div id="fb-root"></div>
<!-- the JavaScript API -->
<script src="http://connect.facebook.net/en_US/all.js"></script>
<!-- the extention script from this article -->
<script src="/scripts/fb.js"></script>
<script>
 //<![CDATA[
 FB.init({apiKey: '***', appId: '***', status: true, cookie: true, fbml5: true});
 //]]>
</script>

This would be the equivalent XHTML code:

<h3>Members</h3>
<fb:login-button show-faces="true" />
<h3>Recent activity</h3>
<fb:activity site="***" width="200" header="false"
 border_color="#fff" recommendations="false" />
<div id="fb-root"></div>
<!-- the JavaScript API -->
<script src="http://connect.facebook.net/en_US/all.js"></script>
<!-- the extention script from this article -->
<script src="/scripts/fb.js"></script>
<script>
 //<![CDATA[
 FB.init({apiKey: '***', appId: '***', status: true, cookie: true, fbml5: true});
 //]]>
</script>

Or you can now use prefix mappings.

<!DOCTYPE html>
<html lang="en" prefix="fb: http://www.facebook.com/2008/fbml">
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!