user1590819
user1590819

Reputation: 55

Facebook Comments Plugin Displays Mobile Width on iPad

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

Upvotes: 2

Views: 1455

Answers (1)

Aseem Kishore
Aseem Kishore

Reputation: 10878

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.

Upvotes: 3

Related Questions