Facebook Comments Plugin Displays Mobile Width on iPad

和自甴很熟 提交于 2019-12-06 13:48:25

I ran into this too. I've worked around it by manually adding the data-mobile attribute set to false if I detect this is on an iPad:

<script>
    if (navigator.userAgent.match(/\biPad\b/)) {
        document.querySelector('div.fb-comments')
            .setAttribute('data-mobile', 'false');
    }
</script>

This could be improved to handle other tablets as well, but the best way to do that depends on how Facebook auto-detects "mobile", which I'm not sure of. Perhaps based on display width, perhaps based on the presence of touch event handlers, or perhaps indeed by user-agent on the server-side.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!