简体   繁体   English

Facebook评论导致iPhone和iOS Safari浏览器出现JavaScript错误

[英]Facebook comments results in javascript error in Safari for iPhone and iOS

I have a problem with Facebook comments, which doesn't work on Safari for the iPhone. 我的Facebook评论有问题,在iPhone的Safari上无法使用。 The Facebook comments works nicely in most browsers, but I get a Javascript error in Safari on the iPhone. Facebook注释在大多数浏览器中都能很好地运行,但是我在iPhone上的Safari中收到Javascript错误。

I have created a minimal test-case here, which shows the problem: http://www.pvv.ntnu.no/~andrearo/fotball.html 我在这里创建了一个最小的测试用例,它显示了问题: http : //www.pvv.ntnu.no/~andrearo/fotball.html

I get the following error message in Safari on the iPhone: 我在iPhone上的Safari中收到以下错误消息:

"Refused to display document because display forbidden by X-Frame-Options". “拒绝显示文档,因为X-Frame-Options禁止显示”。

Could someone please give some advice about how to get this Facebook Comments to work on Safari for iPhone? 有人可以就如何获得此Facebook Comments在iPhone的Safari上运行提供一些建议吗?

This was asked years ago, but I was recently having the same issue and found a solution. 几年前有人问过这个问题,但最近我遇到了同样的问题并找到了解决方案。 It seems that the comments tag needs to have the data-href tag to prevent this. 似乎comment标记需要具有data-href标记以防止这种情况。

If you use: 如果您使用:

<div class="fb-comments"></div>

Most platforms will use the current page url and have no issues. 大多数平台将使用当前页面的URL,并且没有问题。

For iOS, use: 对于iOS,请使用:

<div class="fb-comments" data-href="https://www.google.com/"></div>

With the appropriate URL, of course, and the comments work without error. 当然,使用适当的URL,注释也可以正常工作。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM