Facebook:FBML 上的标记无效
我正在使用 W3C XHTML 验证器来检查我的网站,但在使用 FBML 的页面上遇到一些错误。造成此类错误的大部分原因是“&”特点。由于 FBML 值和属性是动态生成的,因此我无法在显示字符之前对其进行正确编码。
问题:我有办法告诉 Facebook Connect 正确呈现标记吗?
谢谢。
I am using the W3C XHTML validator to check my sites and I am getting some errors on pages with FBML. Most of the cause of such errors is the "&" character. Since FBML values and attributes are generated on the fly, I have no way to encode the character properly before displaying it.
Question: Is there a way for me to tell Facebook Connect to render the mark up properly?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试将 facebook 代码放入 CDATA 中:
Try to put the facebook code in CDATA:
简而言之,据我所知还没有。更糟糕的是,fb:* 标签也不会验证,即使你让你的 html 标签看起来像这样:
如果这对你来说是一个大问题,你可能可以通过放置不符合 XHTML 的标签来逃脱在其自己的 HTML-4.01 严格 iframe 中进行标记,基本上可以清除地毯下的垃圾。
这可能会有所帮助:
http://wiki.developers.facebook.com/index .php/Facebook_Platform_for_Mobile:_XHTML
一些德国人也对此进行了研究:
http://translate.google.com/translate?js=y&prev=_t&hl=en&ie=UTF-8&layout=1&eotf=1&u=http%3A% 2F%2Fwww.ka-mediendesign.de%2Fblog%2Ffbml-in-xhtml-neue-version%2F&sl=de&tl=en
In short, not as far as I know. To make matters worse, the fb:* tags don't validate either, even if you make your html tag look like this:
If this is a huge issue for you, you might be able to get away with putting non-XHTML-compliant markup in its own HTML-4.01-strict iframe, to basically sweep the crap under the rug.
This might be helpful:
http://wiki.developers.facebook.com/index.php/Facebook_Platform_for_Mobile:_XHTML
Some german guy also worked on it:
http://translate.google.com/translate?js=y&prev=_t&hl=en&ie=UTF-8&layout=1&eotf=1&u=http%3A%2F%2Fwww.ka-mediendesign.de%2Fblog%2Ffbml-in-xhtml-neue-version%2F&sl=de&tl=en
我就是这样做的。将所有fbml标签包裹在里面,然后使用js简单地使用javascript取消fbml代码的注释。下面是一个示例:
标记:
JS(需要 JQuery):
This is how i am doing it. Wrap around all fbml tags inside and then use js to simply uncomment the fbml code using javascript. Heres an example:
Markup:
JS (JQuery Required):