Facebook Comments Plugin Displays Mobile Width on iPad

懵懂的女人 提交于 2019-12-08 03:23:55

问题


As the title says. Here is the URL if you have an iPad - How can I remove the responsive width of the Comments Plugin for iPads? (bottom of page) http://dev.assessmentday.co.uk/aptitudetests_numerical.htm


回答1:


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.



来源:https://stackoverflow.com/questions/11984389/facebook-comments-plugin-displays-mobile-width-on-ipad

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